Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#7784 closed Bug (fixed)

FF4: Styles combo remains empty using the stylesheetparser sample

Reported by: Sa'ar Zac Elias Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: CKEditor 3.6
Component: General Version: 3.6
Keywords: Firefox Cc: ron@…

Description

Using FF4 (@ both Mac and Win), in the stylesheetparser sample, the styles combo box does not get filled.

Attachments (4)

7784.patch (1.8 KB) - added by Alfonso Martínez de Lizarrondo 8 years ago.
Proposed patch
7784_2.patch (1.8 KB) - added by Alfonso Martínez de Lizarrondo 8 years ago.
Updated patch
7784_3.patch (1.9 KB) - added by Garry Yao 8 years ago.
stylesheetparser.html (4.0 KB) - added by Sa'ar Zac Elias 8 years ago.

Download all attachments as: .zip

Change History (16)

Changed 8 years ago by Alfonso Martínez de Lizarrondo

Attachment: 7784.patch added

Proposed patch

comment:1 Changed 8 years ago by Alfonso Martínez de Lizarrondo

Owner: set to Alfonso Martínez de Lizarrondo
Status: newreview

The error console shows an error (A parameter or an operation is not supported by the underlying object" code: "15) in the line

			var sheetRules = sheet.cssRules || sheet.rules;

But putting there a breakpoint makes the error go away, so I've changed the code so it uses a timeout before trying to parse the stylesheets and now it's working for me.

comment:2 Changed 8 years ago by Wiktor Walc

(confirmed in Safari 5.0.5 @ Mac as well)

Changed 8 years ago by Alfonso Martínez de Lizarrondo

Attachment: 7784_2.patch added

Updated patch

comment:3 Changed 8 years ago by Alfonso Martínez de Lizarrondo

Increasing the delay to 1 sec makes it work correctly for me. Tested with most of the browsers that I had at hand. That delay isn't really important because it's until the user doesn't click on the combo or moves around the body that he won't notice the contents of the styles combo and it isn't delaying any other pending task.

comment:4 Changed 8 years ago by Wiktor Walc

(I can confirm that the attached patch solved this issue in all the browsers where I was experiencing it)

Changed 8 years ago by Garry Yao

Attachment: 7784_3.patch added

comment:5 Changed 8 years ago by Garry Yao

I'd like to propose another way of fixing which doesn't relies that much on time racing.

comment:6 Changed 8 years ago by Sa'ar Zac Elias

Status: reviewreview_failed

Generally, I'm all for Garry's approach, while it fails to load more than one editor in a page. Use the attached sample file.

Changed 8 years ago by Sa'ar Zac Elias

Attachment: stylesheetparser.html added

comment:7 Changed 8 years ago by Sa'ar Zac Elias

Status: review_failedreview_passed

Sorry, my bad, the sample file is corrupted. R+ for Garry's patch.

comment:8 Changed 8 years ago by Garry Yao

Resolution: fixed
Status: review_passedclosed

Fixed with [6867].

comment:9 Changed 7 years ago by ron

Not sure if this relates to this ticket but I was still getting "A parameter or an operation is not supported by the underlying object" code: "15" when loading a stylesheet in FF4. I am using 3.6.1

The problem was with "var k=i.cssRules| |i.rules;" I was also loading the instance through ajax.

Apparently in FF you can't load a stylesheet and access it in the same function. You some kind of yield in between.

My solution was this...

for(h=0;h<c.styleSheets.length;h++){

var i=c.styleSheets[h],j=i.ownerNode| |i.owningElement;

if(j.getAttribute('data-cke-temp')){

continue;

} if(i.href&&i.href.substr(0,9)=='chrome://'){

continue;

}

if(i.href !== null){

if(!i.cssText){

try{

var tr = (typeof(i.cssRules));

} catch(er){

continue;

}

}

var k=i.cssRules| |i.rules; for(var l=0;l<k.length;l++){

g.push(k[l].selectorText);

}

}

}

The error was being produced when the instance first loaded. After that the stylesheet was loaded the combo would be populated when checked.

Hope this helps.

Last edited 7 years ago by ron (previous) (diff)

comment:10 Changed 7 years ago by ron

Cc: ron@… added

comment:11 Changed 7 years ago by grek

Hy, bug is closed but i install current version CK Editor (ubuntu)

and have : A parameter or an operation is not supported by the underlying object

...Rules
i.rules;for(var l=0;l<k.length;l++)g.push(k[l].selectorText);}var m=a(g,d...

plugin...B8DJ5M3 (6)

So how to run it ?

i simply add : to cfg :

config.extraPlugins='stylesheetparser'; config.contentsCss = '/templates/style.css'; config.stylesSet = [];

and drop list is empty + get error on firebug (firefox) but i check chrome and opera same error....

comment:12 Changed 7 years ago by Alfonso Martínez de Lizarrondo

As closed and released tickets won't be reopened, I've created #8832 to handle the problem.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy