// retoor <retoor@molodetz.nl>
import "html" for Document
var doc = Document.parse("<a href='http://example.com' target='_blank'>Link</a>")
var a = doc.querySelector("a")
System.print(a.getAttribute("href")) // expect: http://example.com
System.print(a.getAttribute("target")) // expect: _blank
System.print(a.getAttribute("nonexistent") == null) // expect: true
System.print(a.hasAttribute("href")) // expect: true
System.print(a.hasAttribute("target")) // expect: true
System.print(a.hasAttribute("nonexistent")) // expect: false
a.setAttribute("title", "Example Link")
System.print(a.getAttribute("title")) // expect: Example Link
System.print(a.hasAttribute("title")) // expect: true
a.removeAttribute("target")
System.print(a.hasAttribute("target")) // expect: false
var attrs = a.attributes
System.print(attrs["href"]) // expect: http://example.com
System.print(attrs["title"]) // expect: Example Link