DmitryBaranovskiy / raphael

JavaScript Vector Library
https://dmitrybaranovskiy.github.io/raphael/
MIT License
11.27k stars 1.67k forks source link

Check that <tspan> computed styles are valid or fallback to default #1066

Closed joshuabalfe closed 7 years ago

joshuabalfe commented 8 years ago

What does this PR do? This PR resolves an edge case I've stumbled across while rendering pages in phantomjs where computed styles for a <tspan> element can end up in a situation where all property values are set as empty strings.

This results in the fontSize value below being NaN. The fix in place will ensure that NaN values at this point also fallback to the default font size of 10.

Notably, if node.firstChild doesn't not exist, fontSize should still fallback to the default as: isNaN(undefined) // true

What is the root cause here? I think that the issue I've observed might be related to something like this https://bugs.webkit.org/show_bug.cgi?id=14563 but am not 100% sure.

Who might be interested in this PR? @tomasAlabes