Closed Bug 748692 Opened 12 years ago Closed 12 years ago

Dynamically created style rule gets disabled/removed

Categories

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

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: t.tampe, Assigned: bzbarsky)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
Build ID: 20120420145725

Steps to reproduce:

I created a style node at runtime and added some style rules to it.
Then I changed the style node's className.
(see attached file for a working demonstration)


Actual results:

The styles did not apply.
It appears, the style rules got deleted.
According to http://forums.mozillazine.org/viewtopic.php?f=25&t=2461781 the same happens if an id is added to the style node.

Note: this works, if the classname is set to the style node before adding the rules.
But: remains a problem, since you can't change the classname.


Expected results:

The styles should apply even if you change the style node's classname.
Attachment #618189 - Attachment mime type: text/plain → text/html
Hmm.  nsHTMLStyleSheet::SetAttr reparses the stylesheet from the textnode contents unconditionally, looks like.  Jonas, is there a reason we're doing that instead of just doing it on changes to title/media/type attributes?
Yeah, the current code looks busted. I don't know of any reason we're doing what we're doing.
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Version: 12 Branch → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
http://hg.mozilla.org/integration/mozilla-inbound/rev/d13475bed11b
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla15
Closed tree makes a liar of me.  Actual changeset: http://hg.mozilla.org/integration/mozilla-inbound/rev/3946bc720e97
https://hg.mozilla.org/mozilla-central/rev/3946bc720e97
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: