blob: 9f977769cb8a0cb9c4431e5135a38a6fbb38b0d2 [file] [log] [blame]
createAttirbuteNS tests adapted from createElementNS tests attached to webkit bug 16833
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.createAttributeNS().toString() is "[object Attr]"
PASS document.createAttributeNS("http://www.example.com").toString() is "[object Attr]"
PASS createAttributeNS(undefined, undefined)
PASS createAttributeNS(null, undefined)
PASS createAttributeNS(undefined, null); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, null); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, ""); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("", null); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("", ""); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "<div>"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "0div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "di v"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "di<v"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "-div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, ".div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "<div>"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "0div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "di<v"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "-div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", ".div"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, ":div"); threw NAMESPACE_ERR
PASS createAttributeNS(null, "div:"); threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", ":div"); threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", "div:"); threw NAMESPACE_ERR
PASS createAttributeNS(null, "d:iv"); threw NAMESPACE_ERR
PASS createAttributeNS(null, "a:b:c"); valid XML name, invalid QName; threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", "a:b:c"); valid XML name, invalid QName; threw NAMESPACE_ERR
PASS createAttributeNS(null, "a::c"); valid XML name, invalid QName; threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", "a::c"); valid XML name, invalid QName; threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", "a:0"); valid XML name, not a valid QName; threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "a:_")
FAIL createAttributeNS("http://example.com/", "a:ெ"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "ெ:a"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "a:aெ")
PASS createAttributeNS("http://example.com/", "aெ:a")
PASS createAttributeNS("http://example.com/", "xml:test"); binding xml prefix wrong; threw NAMESPACE_ERR
PASS createAttributeNS("http://example.com/", "xmlns:test"); binding xmlns prefix wrong; threw NAMESPACE_ERR
PASS createAttributeNS("http://www.w3.org/2000/xmlns/", "x:test"); binding namespace namespace to wrong prefix; threw NAMESPACE_ERR
PASS createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:test")
PASS createAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:test")
PASS createAttributeNS("http://www.w3.org/XML/1998/namespace", "x:test")
PASS createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns")
PASS createAttributeNS("http://example.com/", "xmlns"); threw NAMESPACE_ERR
PASS successfullyParsed is true
TEST COMPLETE