blob: 96654b3e40f719cc9997d34e90ed35e582ece051 [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() threw exception TypeError: Not enough arguments.
PASS document.createAttributeNS("http://www.example.com") threw exception TypeError: Not enough arguments.
PASS createAttributeNS(undefined, undefined)
PASS createAttributeNS(null, undefined)
PASS createAttributeNS(undefined, null)
PASS createAttributeNS(null, null)
PASS createAttributeNS(null, ""); threw INVALID_CHARACTER_ERR
PASS createAttributeNS("", null)
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 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/", "div:"); threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "d:iv"); threw NAMESPACE_ERR
PASS createAttributeNS(null, "a:b:c"); valid XML name, invalid QName; threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "a:b:c"); valid XML name, invalid QName; threw INVALID_CHARACTER_ERR
PASS createAttributeNS(null, "a::c"); valid XML name, invalid QName; threw INVALID_CHARACTER_ERR
PASS createAttributeNS("http://example.com/", "a::c"); valid XML name, invalid QName; threw INVALID_CHARACTER_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