crccheck / raphael-svg-import-classic

Import SVG files to Raphael
MIT License
98 stars 40 forks source link

better text support #25

Closed mattydoincode closed 9 years ago

mattydoincode commented 9 years ago

Reason for PR

In ie8, text was appearing as the word "undefined" regardless of the content of the text element. So for example:

<text font-family="'HelveticaNeue-Medium'" font-size="4.2491">SPEED</text>

In a modern browser, this showed up as SPEED but in ie8 it showed up as undefined.

Solution

A simple change to support where the text was showing up on the elShape object in ie8 vs in chrome, etc. In chrome it was in the property text, or textContent, but in ie8, it was in the properties innerText and outerText. Pretty simple fix.

Additional Test Case

I added a more full featured test case of a speed limit sign to show that the text now works (you'd have to test in ie8 though, which I doubt anyone but me is doing at the moment).

crccheck commented 9 years ago

Sweet, thanks for catching this. I'll get it in later today.

crccheck commented 9 years ago

There's some very minor things, but it looks good to me +1

I'm planning on merging this when I get home in an hour as is. They're my own personal stylistic preferences.