Closed Bug 304713 Opened 19 years ago Closed 19 years ago

Changes made by setAttributeNS and setAttributeNodeNS do not have an effect on dynamic object tags in XHTML served as application/xhtml+xml

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED INVALID

People

(Reporter: shadow2531, Unassigned)

References

()

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

This at least happens on an xhtml page served as application/xhtml+xml using the
default xhtml namespace when you create an object tag with DOM methods to load a
web page.

If you use document.createElementNS("http://www.w3.org/1999/xhtml","object") to
explicitly create an object element under the default namespace and use
setAttributeNS("http://www.w3.org/1999/xhtml", "attribute", "value") to
explicitly set its attributes under the default namespace, when you append the
object to the document, the element gets appended and the attributes are set for
the element, but the attributes have no effect and it appears that the
attributes are set under a different namespace than the one specified.

Same problem happens if you use createAttributeNodeNS and setAttributeNodeNS.

This is not a problem in Opera.

The problem does not happen if you use setAttribute and setAttributeNode.

Specified URL contains test cases and discussion.


Reproducible: Always

Steps to Reproduce:
Try the test cases posted at http://forums.mozillazine.org/viewtopic.php?t=304822
Actual Results:  
object tag is appended to the document, but the web page in it doesn't load.

Expected Results:  
http://www.google.com/ should load in the object tag window.

The easy workaround is to not use NS functions if you are just working with the
default namespace.  However, because there may be problems with setAttributeNS
and setAttributeNodeNS when dealing with other namespaces, this should be rated
as a normal bug that should be fixed.

No problems with Opera.
Attached file testcase1
Testcase1 from reporter
Attached file testcase2
Testcase2 from reporter
Duplicate of bug 192891? See also what bug 212700, comment 2 has to say.
Component: General → Plug-ins
Product: Firefox → Core
Version: unspecified → Trunk
> setAttributeNS("http://www.w3.org/1999/xhtml", "attribute", "value") to
> explicitly set its attributes under the default namespace

The default namespace for attributes is the null namespace.  In XHTML, there are no attributes in the XHTML namespace -- attributes in the null namespace on particular nodes have particular meanings.

This bug is invalid.  Please file a bug on Opera's namespaces in XML implementation if this works in Opera.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
http://www.w3.org/TR/xml-names11/#defaulting
Quote:
the interpretation of unprefixed attributes is determined by the element on which they appear.

<foo xmlns="bar" x="value">

The element "foo" is in the "bar" namespace. "x" is an unprefixed attribute. "x" appears on element "foo". "x" is in the "bar" namespace.
Code:
<foo xmlns="bar"><baz x="value" /></foo>

The element "bar" is in the "bar" namespace because the "bar" namespace was defined on the element "foo" as a default namespace". "x" is an unprefixed attribute. "x" appears on element "baz". "x" is in the "bar" namespace. 

This bug is valid.
No, in neither of those examples is "x" in the "bar" namespace; in both cases it is in the per-element-type partition (sometimes called the null namespace).

Default namespace declarations do not apply to attributes.

For more details see:
   http://www.w3.org/TR/REC-xml-names/

In particular, see the last sentence of the first paragraph of section 5.2. Appendix A.2 goes into more detail about this but may be more confusing than helpful if you are not familiar with XML terminology (e.g. "element type" is
the formal term for "tag name").
Status: RESOLVED → VERIFIED
Jon, see my response in the Mozillazine thread.  In brief, your claims contradict sections 5.2, 5.3, and A.2 of Namespaces in XML.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: