Closed Bug 290341 Opened 20 years ago Closed 11 years ago

It should be possible to set the name of the ID and class attributes of XML elements

Categories

(Core :: DOM: Core & HTML, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: smaug, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

It would be useful if for example an XBL binding could set the
name of the ID and class attributes of an XML element.
XHTML/XUL/SVG don't need this feature.

Something like
var scri = 
  anElement.QueryInterface(Components.interfaces.nsIScriptableStyledContent);
scri.setIdAttributeName("id");
scri.setClassAttributeName("class");


This will be needed by the XForms extension.
So do we want to allow pages to access this?  What happens if they do?
(In reply to comment #2)
> So do we want to allow pages to access this?  What happens if they do?

Yes we do want to allow pages to access this. That is the way how content
authors can define their own XBL bindings for (abstract) XForms UI controls
and still support ID and class attributes.

And what happens... well, the name of the ID and/or class attribute
changes :)

What I mean is, what happens if some content page overrides this on an XForms
control?  Will the XForms module deal?
XForms doesn't rely the ID attribute to be 'id'.
"A host language must permit an attribute of type xsd:ID on each XForms element."
And the current implementation doesn't care which attribute is the ID.
Changing class attribute may just break the styling (?), 
but that is then up to the content author.
Assignee: general → smaug
Attachment #180729 - Attachment is obsolete: true
Status: NEW → ASSIGNED
There is no one attribute that is an ID or one attribute that is a class. It's
just that attributes can be class attribute and ID attributes.

For example, a language could define an attribute foo:bar that is a class
attribute, such that:

   <html:li foo:bar="a" class="b">

...is an element in classes "a" and "b". Same with IDs. You can set an attribute
to type ID through the DOM, using xml:id, using a DTD internal subset, using
namespace-specific knowledge (e.g. we know that <html:* id=""> is an ID
attribute). An element can have multiple IDs and multiple classes on multiple
class attributes.
(In reply to comment #7)
> There is no one attribute that is an ID or one attribute that is a class. It's
> just that attributes can be class attribute and ID attributes.
> 

I'm aware of this, but the XForms extension will need something quite soon, I
think. 
The multiple IDs will be handled in Bug 288513, but that implementation
won't probably work as fast as this one.
xml:id is Bug 275196.

I don't think there is a bug filed to support multiple class attributes.

QA Contact: ian → general
We don't want this.
Assignee: bugs → nobody
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: