#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)
Change History (16)
Changed 14 years ago by
Attachment: | 7784.patch added |
---|
comment:1 Changed 14 years ago by
Owner: | set to Alfonso Martínez de Lizarrondo |
---|---|
Status: | new → review |
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:3 Changed 14 years ago by
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 14 years ago by
(I can confirm that the attached patch solved this issue in all the browsers where I was experiencing it)
Changed 14 years ago by
Attachment: | 7784_3.patch added |
---|
comment:5 Changed 14 years ago by
I'd like to propose another way of fixing which doesn't relies that much on time racing.
comment:6 Changed 14 years ago by
Status: | review → review_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 14 years ago by
Attachment: | stylesheetparser.html added |
---|
comment:7 Changed 14 years ago by
Status: | review_failed → review_passed |
---|
Sorry, my bad, the sample file is corrupted. R+ for Garry's patch.
comment:8 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Fixed with [6867].
comment:9 Changed 13 years ago by
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.
comment:10 Changed 13 years ago by
Cc: | ron@… added |
---|
comment:11 Changed 13 years ago by
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
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 13 years ago by
As closed and released tickets won't be reopened, I've created #8832 to handle the problem.
Proposed patch