markkit works on Safari

To be honest, markkit always worked on safari. The only problem was interoperability between Safari and Firefox. Thus highlights made using Firefox were not visible to Safari users, and the other way around also.

I nailed it last week when I was unable to see highlights from @houeida which is a mac user using my Firefox2. Today I thought it was time to investigate a bit more to see if i can fix it quickly. And in fact, I tried and it worked. I never been so happy for having made the right choice of developing for the standards from the beginning of the project. I mean, I just got support for Safari almost for free.

But what was going on in first place? It happens that the generated DOM trees from Safari and Firefox are almost identical, since they both conform to w3c standards. The only difference is the position of the body node : it’s the first child node of document in Safari and the second in Firefox.

Now, I did not even had to bother know what was actually the first child node of document in Firefox. All I got to do is setting document.body as a root node for markkit in place of document. And everything worked. DOM magic.

Advertisements

Post a Comment

Required fields are marked *
*
*

%d bloggers like this: