Bug 15172 - object fallback - empty string for first argument of setAttributeNS does not work like null
: object fallback - empty string for first argument of setAttributeNS does not ...
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: HTML DOM
: 523.x (Safari 3)
: PC All
: P2 Normal
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-10 11:04 PDT by Michael A. Puls II
Modified: 2009-03-14 21:23 PDT (History)
1 user (show)

See Also:


Attachments
XHTML TC (815 bytes, application/xhtml+xml)
2007-09-10 11:05 PDT, Michael A. Puls II
no flags Details
createElementNS test (427 bytes, text/html)
2007-10-29 22:52 PDT, Michael A. Puls II
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael A. Puls II 2007-09-10 11:04:01 PDT
Tested with WebKit-SVN-r25455.

setAttributeNS takes a string for the first argument. Therefore, if you want to put an attribute in the null namespace, you would use "".

This works fine in Opera and Firefox (so does null), but webkit requires null.

If you do setAttributeNS("", "type", "application/x-unrecognized") on an object element and append it to the document, if the object has fallback content, it won't be shown unless you use null instead.
Comment 1 Michael A. Puls II 2007-09-10 11:05:11 PDT
Created attachment 16246 [details]
XHTML TC
Comment 2 Alexey Proskuryakov 2007-09-10 21:57:24 PDT
From DOM3Core: "Applications should use the value null as the namespaceURI parameter for methods if they wish to have no namespace. In programming languages where empty strings can be differentiated from null, empty strings, when given as a namespace URI, are converted to null." Also: "applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace."

So, while null is the preferred form, both null and empty string should work.
Comment 3 Michael A. Puls II 2007-10-29 22:52:43 PDT
Created attachment 16943 [details]
createElementNS test

This affects createElementNS also and probably other ns functions.

createElementNS("", "div") should do the exact same thing as createElementNS(null, "div"), but it doesn't in Safari. Works fine in Opera and FF.
Comment 4 Alexey Proskuryakov 2009-03-14 04:57:17 PDT
Fixed with bug 24548 in <http://trac.webkit.org/changeset/41700>.
Comment 5 Michael A. Puls II 2009-03-14 21:23:16 PDT
Thanks!