Bug 5153 - deleteRule and insertRule do not work
Summary: deleteRule and insertRule do not work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 312.x
Hardware: Mac OS X 10.3
: P2 Normal
Assignee: Anders Carlsson
URL: http://www.quirksmode.org/dom/tests/s...
Keywords:
: 5511 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-27 11:15 PDT by Mihai Parparita
Modified: 2006-01-12 13:46 PST (History)
1 user (show)

See Also:


Attachments
Fix (11.38 KB, patch)
2006-01-12 09:09 PST, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Parparita 2005-09-27 11:15:06 PDT
The linked URL is a simple test case for inserting and deleting rules from a
stylesheet object.  

Expected behavior (as observed in Firefox):
- clicking on the "x.deleteRule(0)" link causes the red text to become purple
- clicking on the "x.insertRule..." link causes the text to have a black border

Observed behavior (as observed in Safari 312.3):
- No visible changes occur (and no errors are reported in the JavaScript console)
Comment 1 Alexey Proskuryakov 2006-01-03 16:02:48 PST
*** Bug 5511 has been marked as a duplicate of this bug. ***
Comment 2 Anders Carlsson 2006-01-12 09:09:31 PST
Created attachment 5620 [details]
Fix
Comment 3 Darin Adler 2006-01-12 09:34:25 PST
Comment on attachment 5620 [details]
Fix

+  removeRule	 DOMCSSStyleSheet::RemoveRule	 DontDelete|Function 0

Number of parameters here should be 1, not 0.

This patch makes two fixes. One is about updating the disabled flag on style
sheets. That fix has no layout test. I think that fix should be landed
separately, but it might be OK to land them together if there was a test for
it.

Otherwise, looks great.
Comment 4 Anders Carlsson 2006-01-12 09:53:45 PST
(In reply to comment #3)
> (From update of attachment 5620 [details] [edit])
> +  removeRule	 DOMCSSStyleSheet::RemoveRule	 DontDelete|Function 0
> 
> Number of parameters here should be 1, not 0.
> 

Isn't the number the minimum required number? The MSDN documentation on removeRule says:

iIndex	 Optional. Integer that specifies the index value of the rule to be deleted from the style sheet. 
If an index is not provided, the first rule in the rules collection is removed.


> This patch makes two fixes. One is about updating the disabled flag on style
> sheets. That fix has no layout test. I think that fix should be landed
> separately, but it might be OK to land them together if there was a test for
> it.

It actually has a test:

var s3 = document.getElementById('style3').sheet;
s3.disabled = true;

> 
> Otherwise, looks great.
> 

Comment 5 Anders Carlsson 2006-01-12 09:54:17 PST
Comment on attachment 5620 [details]
Fix

I'll mark it as ? again
Comment 6 Darin Adler 2006-01-12 10:21:54 PST
Comment on attachment 5620 [details]
Fix

I still think the number of parameters for removeRule is wrong; we have to
check with WinIE. This patch is otherwise great.

I think I'll mark this review+ and let Anders investigate that one last part.
Comment 7 Anders Carlsson 2006-01-12 13:46:52 PST
(In reply to comment #6)
> (From update of attachment 5620 [details] [edit])
> I still think the number of parameters for removeRule is wrong; we have to
> check with WinIE. This patch is otherwise great.
> 
> I think I'll mark this review+ and let Anders investigate that one last part.
> 

Apparently WinIE doesn't have a length property on the removeRule function. I changed it to 1 and 
landed the patch.