Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element.setStyle failing in FF 20.0.1 #143

Closed
jwestbrook opened this issue Apr 22, 2014 · 2 comments
Closed

element.setStyle failing in FF 20.0.1 #143

jwestbrook opened this issue Apr 22, 2014 · 2 comments

Comments

@jwestbrook
Copy link
Collaborator

previous lighthouse ticket #3101
by Eric Friedman


Although the following prototype 1.7.1 statement works as expected in Chrome and IE10, it fails to set the background color of titleDiv in Firefox 20:
titleDiv.setStyle({ "background-color": titleBackgroundColor });

However, the following standard javascript statement works just fine in all 3 browsers:
titleDiv.style.backgroundColor = titleBackgroundColor;

@jwestbrook
Copy link
Collaborator Author

According to the documentation you need to use the camelCase version of the style attribute, backgroundColor vs background-color.
http://api.prototypejs.org/dom/Element/prototype/setStyle/
Chrome and IE10 are more forgiving on the style properties however Firefox is not.

@savetheclocktower
Copy link
Collaborator

Closing this for now. If other people end up reporting it, it might be worth guarding against this error somehow — either by attempting to convert to camelCase or by warning the user that hyphenated properties aren't going to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants