Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Dynamically created style rule gets disabled/removed

RESOLVED FIXED in mozilla15

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Thomas Tampe, Assigned: bz)

Tracking

Trunk
mozilla15
x86_64
Windows 7
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
Created attachment 618189 [details]
HTML page demonstrating the bug

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.

Updated

5 years ago
Attachment #618189 - Attachment mime type: text/plain → text/html
(Assignee)

Comment 1

5 years ago
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)

Comment 3

5 years ago
Created attachment 626702 [details] [diff] [review]
Don't reparse inline stylesheets on random attribute changes.
Attachment #626702 - Flags: review?(jonas)
(Assignee)

Updated

5 years ago
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Version: 12 Branch → Trunk
(Assignee)

Updated

5 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #626702 - Flags: review?(jonas) → review+
(Assignee)

Comment 4

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/d13475bed11b
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla15
(Assignee)

Comment 5

5 years ago
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.