attribute selectors confused by default namespace

RESOLVED INVALID

Status

()

Core
CSS Parsing and Computation
RESOLVED INVALID
7 years ago
7 years ago

People

(Reporter: Daniel.S, Unassigned)

Tracking

({css3})

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(6 attachments, 1 obsolete attachment)

(Reporter)

Description

7 years ago
Created attachment 520507 [details]
[ns|attr] with default namespace and prefix declared

When a default namespace is declared using @namespace, attribute selectors partially start to work incorrectly.

Compared to a stylesheets without default namespace,

* [ns|attr] does not apply to attributes that are XML prefixed
  (i.e. <element prefix:attr="">).
* [*|attr] does not apply to any element having an attr attribute.
* [|attr] (and [attr]) do not apply if the element has
  its namespace defined by the xmlns attribute.

Without a default namespace declared, these examples work fine.

[|attr] and [attr] actually start to work again, when the xmlns attribute is defined on their parent element instead. I don't know if thats just a coincidence or if there is some magic at work I do not understand (namely the per-element-type partition which is defined in older XML Namespaces revisions).
(Reporter)

Comment 1

7 years ago
Created attachment 520508 [details]
[*|attr] with default namespace only
(Reporter)

Comment 2

7 years ago
Created attachment 520509 [details]
[|attr] with default namespace only

[attr] gives the same results.
According to CSS Selectors Level 3 it's equivalent.
I think you've forgotten that the default namespace turns the implicit * that comes before [attr=val] into ns|*.  In other words, [attr=val] is in some sense shorthand for *[attr=val], and the default namespace affects the *.

Given that, I *think* our behavior on all of these cases looks correct, although I could be missing something.  Please reopen if I have.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
See section 6.2 and 6.2.1 of css3-selectors:
http://www.w3.org/TR/css3-selectors/#universal-selector
Created attachment 520535 [details]
[ns|attr] with default namespace and prefix declared (revised with *|* type selector)
Created attachment 520536 [details]
[*|attr] with default namespace only (revised with *|* type selector)
Created attachment 520537 [details]
[|attr] with default namespace only (revised with *|* type selector)
Created attachment 520538 [details]
[ns|attr] with default namespace and prefix declared (revised with *|* type selector)

Oops, uploaded the wrong file for the first one.


In any case, when I revised the tests to use (in the necessary places) *|* type selectors instead of implicit-* (and thus implicitly namespaced) type selectors, I get your expected results.
Attachment #520535 - Attachment is obsolete: true
(Reporter)

Comment 9

7 years ago
(In reply to comment #3)
> I think you've forgotten that the default namespace turns the implicit * that
> comes before [attr=val] into ns|*.  In other words, [attr=val] is in some sense
> shorthand for *[attr=val], and the default namespace affects the *.

Yes, of course... That's the problem I had. Sleeping on it for a night didn't help apparently. Yes, again, with this in mind, all the results match my expectation. Thanks for the hint.
You need to log in before you can comment on or make changes to this bug.