The spec here (https://drafts.csswg.org/cssom/#cssstylerule) states that the style attribute on Element has [PutForwards=cssText] in the CSSOM spec and cssText is of DOMString type. You should be able to modify the element.style variable by the following: element.style = 'valid css' The attached file shows First:: 200 Second:: 0 on both FF and Chrome It shows First:: 200 Second:: 200 on Safari and IE. Also you can take a look at the relevant discussion on the Chrome bug here: https://bugs.chromium.org/p/chromium/issues/detail?id=662664
<rdar://problem/29181773>
Created attachment 312230 [details] testcase 1 (for CSSStyleRule) Here's a testcase that directly targets CSSStyleRule.style (no element involved). Firefox and Chrome print out "AAA", then "BBB", then "CCC" in the web console. WebKit doesn't accept the CCC, though, due to the |rule.style| assignment failing, due to this bug.
Here's the relevant part of the spec for the element.style attribute, I think: https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface > interface ElementCSSInlineStyle { > [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; > }; And for the CSSStyleRule.style attribute: https://drafts.csswg.org/cssom/#the-cssstylerule-interface > interface CSSStyleRule : CSSRule { > attribute CSSOMString selectorText; > [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; > };
Looks like I fixed part of this. element.style is settable after Bug 171795. However, it looks like we still need to make CSSStyleRule.style settable.
Oh, nice! You're in the same camp as Edge, then. (See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12271447/ - they can set element.style but not rule.style, too.)
(In reply to Daniel Holbert from comment #5) > Oh, nice! You're in the same camp as Edge, then. (See > https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/ > 12271447/ - they can set element.style but not rule.style, too.) I'll fix the rest today. It is trivial.
Created attachment 312250 [details] WIP Patch
Comment on attachment 312250 [details] WIP Patch Attachment 312250 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/3890807 New failing tests: imported/w3c/web-platform-tests/cssom/interfaces.html imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Created attachment 312257 [details] Archive of layout-test-results from ews101 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Comment on attachment 312250 [details] WIP Patch Attachment 312250 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/3890761 New failing tests: imported/w3c/web-platform-tests/cssom/interfaces.html imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Created attachment 312258 [details] Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Comment on attachment 312250 [details] WIP Patch Attachment 312250 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/3890818 New failing tests: imported/w3c/web-platform-tests/cssom/interfaces.html imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Created attachment 312259 [details] Archive of layout-test-results from ews106 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Comment on attachment 312250 [details] WIP Patch Attachment 312250 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3890873 New failing tests: imported/w3c/web-platform-tests/cssom/interfaces.html imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Created attachment 312262 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.5
Created attachment 312266 [details] Patch
Comment on attachment 312266 [details] Patch PutForwards on the mind?
(In reply to Sam Weinig from comment #17) > Comment on attachment 312266 [details] > Patch > > PutForwards on the mind? :)
Comment on attachment 312266 [details] Patch Clearing flags on attachment: 312266 Committed r217917: <http://trac.webkit.org/changeset/217917>
All reviewed patches have been landed. Closing bug.