Closed Bug 309067 Opened 19 years ago Closed 19 years ago

Implement :-moz-empty-except-children-with-localname(localname)

Categories

(Core :: CSS Parsing and Computation, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

From bug 8131:

> According to the behaviour spec, we need to apply
> different styles to AREA elements if the IMG element is broken and the MAP
> element only contains AREA elements.

And similarly, the patch for bug 11011 has in it:

+/* Nonempty applets should just show their kids.
+   XXXbz do we need a selector that will ignore <param> elements? */

So perhaps we should have a selector like :-moz-empty-except(ns|localname) that
would match if the only kids are either ns:localname, or ignorable whitespace,
comments, etc?
Sounds like it would have the same potential problems as my more wide-reaching
:matches() suggestions, namely it would require a crawl of the element's
children which would potentially be slow. Other than that, seems fine to me.
It only requires a crawl if we have a bunch of kids that have that fully
qualified name.  As soon as we hit any kid that doesn't, we know we don't match.

So it's really not any slower than :-moz-only-whitespace...
Blocks: 309528
I can try to think of a less short but still scary name
Attachment #197231 - Flags: superreview?(dbaron)
Attachment #197231 - Flags: review?(dbaron)
Does that support ns|localname, or just localname?
That supports just localname and will only match if the ns of the kid is the
same as the ns of the node we're matching.

Given the (internal) uses for it we want, that restriction was acceptable, and I
wasn't quite prepared to refactor the ns|localname parsing code such that I
could reuse it here.
Oh, and this treats the localname as a literal, so * gets no special treatment
(and in fact won't parse, since that's not an ident).
aha, I missed the bit in the patch where you checked the parent's namespace.
Yeah,  that sounds perfect. Cunning.
Comment on attachment 197231 [details] [diff] [review]
Something silly along these lines

>Index: dom/locales/en-US/chrome/layout/css.properties
>+PEPseudoClassArgEOF=argument to pseudo-class selector
>+PEPseudClassArgNotIdent=Expected identifier for pseudo-class parameter but found '%1$S'.
>+PEPseudoClassNoClose=Missing closing ')' in pseudo-class '%1$S'.
>+PEPseudoClassNoArg=Missing argument in pseudo-class '%1$S'.

You lost the "o" on the second one of these.

Please test that the error messages still work to double-check that there
weren't other similar mistakes.
Attachment #197231 - Flags: superreview?(dbaron)
Attachment #197231 - Flags: superreview+
Attachment #197231 - Flags: review?(dbaron)
Attachment #197231 - Flags: review+
Assignee: dbaron → bzbarsky
Attachment #197231 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla1.9alpha
Blocks: 114641
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Summary: Consider implementing :-moz-empty-except(ns|localname) → Implement :-moz-empty-except-children-with-localname(localname)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: