New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 662664 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Not on Chrome anymore
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Change Element.style using javascript object

Reported by annamala...@gmail.com, Nov 5 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36

Steps to reproduce the problem:
1. Open the attached file
2.  See the console
3. 

What is the expected behavior?

What went wrong?
In detail ,

I have an HTML element with some inline styles set , then when query

Element.offsetHeight --> it logs correctly

Then when try to manipulate Element.style using javascript object,
It totally unsets style attribute , eg.,

Element.style = {
  height : '500px'
}

Then if I again query for height , 
Element.offsetHeight --> it logs  0

I expect setting Element.style with a js object should fail silently , and should log element's height

Safari's behaviour seems correct 

Did this work before? N/A 

Does this work in other browsers? No
 In Firefox and Chrome , it logs 200,0
And in Safari  200,200

Chrome version: 54.0.2840.71  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 23.0 r0
 
jsbin.qahevipaqe.1.html
728 bytes View Download
Components: Blink>CSS
Labels: OS-Chrome OS-Linux OS-Windows
Someone should double-check but AFAIK this is WAI. The style attribute on Element has [PutForwards=cssText] in the CSSOM spec and cssText is of DOMString type, so we'll serialize the object to "[object Object]", which has no valid declarations in it.

Comment 3 Deleted

The spec says style property (https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style#Setting_style)  is read-only , so setting any value should silently fail. Both Safari and IE , logs 200,200 . It seems correct to me , Open for discussion ! Thx 


Owner: nainar@chromium.org
Status: Assigned (was: Unconfirmed)
This behavior introduced in https://chromium.googlesource.com/chromium/src/+/d1a7b0cbd0a511459f0f6202dfe61e27aa47df46
Labels: -Type-Bug Type-Bug-Regression
The spec here (https://drafts.csswg.org/cssom/#cssstylerule) corroborates #2. The spec OP links to in #4 seems outdated (last updated Nov 2000.)

Also FF logs the same as us: 
First:: 200
Second:: 0

Leaning towards WontFix. Filing a bug on WebKit. Will post the link here when done. 
Status: WontFix (was: Assigned)
https://bugs.webkit.org/show_bug.cgi?id=164537
I didn't know , it forwards to cssText. Thanks ! I thought this is similar to operation like setting navigator.userAgent (which fails silently) 

Sign in to add a comment