Closed Bug 202138 Opened 22 years ago Closed 11 years ago

deleteRule does not work with @import

Categories

(Core :: DOM: CSS Object Model, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dhtmlkitchen, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312

rule 0 is "@import 'vegBg.css'"

vegBg.css contains a backgroung image.

deleteRule(0) deletes the rule, but the background image stays (so do other
properties).

Reproducible: Always

Steps to Reproduce:
1. try the demo.
2.
3.

Actual Results:  
I see font-style: oblique and veggie bg image.

Expected Results:  
when imported rule is deleted, we should see a visual result.
Attached file imported css for following attachment (obsolete) —
fixed url for background-attachment to point to bugzilla's location
Attachment #120586 - Attachment is obsolete: true
So.. I assume deleting the @import rule _is_ supposed to remove the child sheet?
 (The spec is not exactly very clear here....)
Keywords: qawanted
Summary: deleteRule does not work with @import → deleteRule does not work with @import
Over to Ian, since "qawanted" is not having its desired effect.  ;)
Assignee: dom_bugs → ian
Well what else could it do?
Assignee: ian → dom_bugs
It could also remove the rule from the sheet, such that when the sheet is
serialized it is no longer present, but without affecting the page's stylistic
information.
Seems like that would be rather inconsistent with the effect of removing any of
the other rules in the sheet, which we agree does affect the rendering.
Removing @charset rules does not.  Removing @namespace rules may or may not
(it's not clear what the hell it should do exactly).
Those two affect the parsing, not the semantics of the document. At least,
that's my line and I'm sticking to it until there's a spec that disagrees with
me. :-P
In case you care, I checked.  In our impl, _inserting_ an @namespace rule makes
it take effect, while removing one does not make it not take effect.

And it DOES affect the semantics.  Consider the following DOM2 calls:

sheet.insertRule("@namespace foo url(bar);", 0);
sheet.insertRule("foo|div { color: green }", sheet.cssRules.length);
sheet.deleteRule(0);
sheet.insertRule("foo|div { color: red }", sheet.cssRules.length);

The div in the foo namespace should be green.

So my point is, the spec does not clearly describe what should be happening here
(and I too could pull out the "nothing should change and there is no spec that
disagrees with me" crap...  ;) )

It does make sense to me that the child sheets would be removed when the @import
rule is removed, though....  
Depends on: 183038
> sheet.insertRule("@namespace foo url(bar);", 0);
> sheet.insertRule("foo|div { color: green }", sheet.cssRules.length);
> sheet.deleteRule(0);
> sheet.insertRule("foo|div { color: red }", sheet.cssRules.length);
> 
> The div in the foo namespace should be green.

(I assume you mean "bar namespace".)

What should happen in the CSSOM with namespaces is totally undefined. I agree
with what you say should happen, but that's not changing the semantics of the
existing rules, it's changing the semantics of parsing future rules, which isn't
want I meant by "changing semantics".

The point being that once you parse the "foo|div" selector, the concept of "foo"
is lost, the selector becoming internally equivalent to "{bar}foo" -- the prefix
is no longer relevant. Upon serialising, a UA will probably want to be clever
and look at what prefixes are available, and serialise using the appropriate one
(and whine if there isn't one for that namespace), but that, again, is not a
change to the semantics.


As for this bug, I think we're agreed -- changing @import rules should affect
the actual import, live.
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
Dropping qawanted since it was satisfied in comments 7-13
Keywords: qawanted
FF 24 on Ubuntu.

The desired effect of the stylesheet being deleted seems to be taking effect, live.

The vegBg, declared with a higher specificity (HTML > BODY), is not shown. Instead see the red background declared with (BODY).

I'm am declaring this RESOLIVED FIXED.

User-Agent: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0"
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Resolution: FIXED → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: