Bug Tracker

Opened 5 years ago

Closed 5 years ago

#12235 closed bug (fixed)

getComputedStyle is used without namespace

Reported by: brilliantpenguin@… Owned by: Rick Waldron
Priority: low Milestone: 1.8.1
Component: css Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:


v1.8.0 L:6612 says:

"computed = getComputedStyle( elem, null )"

but in any other place, you are using window.getComputedStyle.

I'm using jQuery on Node.js, then it's a big problem.

I want to fix to window.getComputedStyle same as the "If( window.getComputedStyle)" in L:6609.

or change L:6609 to "if(getComputedStyle)"

Change History (7)

comment:1 Changed 5 years ago by dmethvin

Milestone: None1.8.1
Status: newopen

comment:2 Changed 5 years ago by mikesherov

Component: unfiledcss
Owner: set to mikesherov
Priority: undecidedlow
Status: openassigned

This was done to save bytes. I guess it's not worth the savings to break node.

comment:3 Changed 5 years ago by Rick Waldron

Owner: changed from mikesherov to brilliantpenguin@…
Status: assignedpending

jQuery on Node.js? Are you using jsdom? If so, then you should create a window property on the global object

comment:4 Changed 5 years ago by anonymous

Yes. I'm using jsdom and create window on global namespace. but unfortunately on Node.js, the top scope is not window but global. so that I can access to window.getComputedStyle but cannot access to "getComputeStyle" because of "no such a function". It does not happen v1.7.2 so that I wrote a bug report.

comment:5 Changed 5 years ago by brilliantpenguin@…

Status: pendingnew

(the comment previous is my comment)

comment:6 Changed 5 years ago by Rick Waldron

Owner: changed from brilliantpenguin@… to Rick Waldron
Status: newassigned

Right, got it. Fix coming

comment:7 Changed 5 years ago by Rick Waldron

Resolution: fixed
Status: assignedclosed

Use window.getComputedStyle to prevent breaking jsdom/node.js . Fixes #12235

Changeset: 3722aef8be5d31a7dbf3de6998cdf249081f028c

Note: See TracTickets for help on using tickets.