Bug Tracker

Ticket #12235 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

getComputedStyle is used without namespace

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

Description

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

comment:1 Changed 2 years ago by dmethvin

  • Status changed from new to open
  • Milestone changed from None to 1.8.1

comment:2 Changed 2 years ago by mikesherov

  • Owner set to mikesherov
  • Priority changed from undecided to low
  • Status changed from open to assigned
  • Component changed from unfiled to css

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

comment:3 Changed 2 years ago by rwaldron

  • Owner changed from mikesherov to brilliantpenguin@…
  • Status changed from assigned to pending

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

comment:4 Changed 2 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 2 years ago by brilliantpenguin@…

  • Status changed from pending to new

(the comment previous is my comment)

comment:6 Changed 2 years ago by rwaldron

  • Owner changed from brilliantpenguin@… to rwaldron
  • Status changed from new to assigned

Right, got it. Fix coming

comment:7 Changed 2 years ago by Rick Waldron

  • Status changed from assigned to closed
  • Resolution set to fixed

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

Changeset: 3722aef8be5d31a7dbf3de6998cdf249081f028c

Note: See TracTickets for help on using tickets.