Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11772 closed defect (fixed)

Editor addStyleSheet adds the stylesheet to the wrong scope

Reported by: Katie Vance Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.6
Component: Editor Version: 1.5
Keywords: Cc:
Blocked By: Blocking:


The addStyleSheet method is adding the stylesheet to the top level document. Instead, shouldn't it add the stylesheet to the editor's document?

This can be seen by clicking the buttons in the test_RichText.html test. At first it appears that the remove is broken, however, it is really the add because once the stylesheet is added, you can see it modifies the h1 element at the top level, not the h1 element in the editor.

Attaching a patch...

Attachments (1)

Editor_addStylesheet.patch (1.0 KB) - added by Katie Vance 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by Katie Vance

Attachment: Editor_addStylesheet.patch added

comment:1 Changed 11 years ago by Jared Jurkiewicz

The fix is simpler than your patch, actually.

this.onLoadDeferred.addCallback(dojo.hitch(this, function(){...

Would do it. The hitch was missing the scope (Eg, the editor), when being set.

comment:2 Changed 11 years ago by Jared Jurkiewicz

Index: RichText.js
--- RichText.js	(revision 22883)
+++ RichText.js	(working copy)
@@ -636,7 +636,7 @@
-		this.onLoadDeferred.addCallback(dojo.hitch(function(){
+		this.onLoadDeferred.addCallback(dojo.hitch(this, function(){
 			if(this.document.createStyleSheet){ //IE
 			}else{ //other browser

Is simpler and I believe will solve it fine.

comment:3 Changed 11 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [22899]) Fixing addStyleSheet. \!strict fixes #11772

comment:4 Changed 11 years ago by Jared Jurkiewicz

Milestone: tbd1.6
Note: See TracTickets for help on using tickets.