svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
269 stars 53 forks source link

Does getComputedStyle do anything? #81

Closed hegelstad closed 2 years ago

hegelstad commented 3 years ago

Referring to this function:

https://github.com/svgdotjs/svgdom/blob/13083d30945a9c0c0faca37c1b172d3a6c413ce7/src/dom/Window.js#L42-L64

Does it do anything except from returning a function which it does not call?

Fuzzyma commented 3 years ago

no, if you execute getComputedStyle in your Browser it will also return a function (beside all style values). I only need the function so I don't bother with returning values since we don't compute styles anyway for the most part. Its only important for measuring font dimensions

hegelstad commented 3 years ago

I understand. My confusion was about all the style values. So I would need another library like Puppeteer or PhantomJS I suppose to get these values correctly.

On 27 Aug 2021, at 15:55, Ulrich-Matthias Schäfer @.***> wrote:

 no, if you execute getComputedStyle in your Browser it will also return a function (beside all style values). I only need the function so I don't bother with returning values since we don't compute styles anyway for the most part. Its only important for measuring font dimensions

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

--

Navigate Change with Confidence


Oslo - New York - London - Copenhagen

Fuzzyma commented 3 years ago

If you need a complete rendering engine, yes! Svgdom just gives you Dom. It will not calculate styles or render anything. For that you need an actual browser