WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 176454
226972
CSSStyleDeclaration.overscrollBehaviorX setter behaves differently from Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=226972
Summary
CSSStyleDeclaration.overscrollBehaviorX setter behaves differently from Chrom...
zyscoder@gmail.com
Reported
2021-06-14 07:38:46 PDT
Steps to reproduce: (1) Open a tab and navigate to any URL; (2) Run the following code in the Console of Devtools: ``` obj = getComputedStyle(new Audio()); obj.overscrollBehaviorX = ''; ``` Actual results: This code would be evaluated successfully without throwing any exceptions. Expected results: In my test, Chrome and Firefox would throw exceptions: Chrome: `DOMException: Failed to set the 'overscroll-behavior-x' property on 'CSSStyleDeclaration': These styles are computed, and therefore the 'overscroll-behavior-x' property is read-only.` Firefox: `CSS2Properties.overscrollBehaviorX setter: Can't set value for property 'overscroll-behavior-x' in computed style` It seems better for Webkit to align with Chrome and Firefox.
Attachments
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-06-15 09:00:31 PDT
`obj.setProperty("overscrollBehaviorX", '');` does throw but `obj.overscrollBehaviorX = '';` does not.
Chris Dumez
Comment 2
2021-06-15 09:12:00 PDT
(In reply to Chris Dumez from
comment #1
)
> `obj.setProperty("overscrollBehaviorX", '');` does throw but > `obj.overscrollBehaviorX = '';` does not.
We don't seem to have a named property setter (only a named getter), and neither does the spec:
https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface
However, Chrome has one: [CEReactions, CallWith=ScriptState] setter void (DOMString property, [TreatNullAs=EmptyString] DOMString propertyValue);
Sam Weinig
Comment 3
2021-06-15 09:47:29 PDT
Named properties are now handled by the generated IDL file named CSSStyleDeclaration+PropertyNames.idl. For this specific property it is: [CEReactions, DelegateToSharedSyntheticAttribute=propertyValueForCamelCasedIDLAttribute, CallWith=PropertyName, EnabledBySetting=overscrollBehavior] attribute [LegacyNullToEmptyString] CSSOMString overscrollBehaviorX; This is part of the camel cased variant, so the spec for this is:
https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel_cased_attribute
For setting, the spec says: Setting the camel-cased attribute attribute must invoke setProperty() with the first argument being the result of running the IDL attribute to CSS property algorithm for camel-cased attribute, as second argument the given value, and no third argument. Any exceptions thrown must be re-thrown. So it seems like something is busted with setPropertyValueForCamelCasedIDLAttribute()? I can look into this.
Sam Weinig
Comment 4
2021-06-15 09:53:21 PDT
Oh, actually, this is probably due to OverscrollBehaviorEnabled being disabled, in which case this is behaving correctly. If OverscrollBehaviorEnabled is disable, the property case behaves as if there is nothing called obj.overscrollBehaviorX, so just the same as obj.fakeProperty = 1 would. It sets an "expando" / custom property on the object. If OverscrollBehaviorEnabled is enabled, this will throw, as the property exists and is readonly due to the declaration being a computed style. My guess is that chrome and Firefox have support for overscroll-behavior-x enabled by default. I think this is behaves correctly.
Chris Dumez
Comment 5
2021-06-15 09:57:07 PDT
*** This bug has been marked as a duplicate of
bug 176454
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug