This comes from a popular question on Stack Overflow. Given the popularity of the question, the fact that it is now closed and the fact that the highest-ranked answer there is a little imprecise, I’ve decided to write up an explanation here.
Here’s the problem: HTML and XHTML pages containing empty elements with no end tag such as
childNodes collection. Continue reading
Today I needed to know whether a Range object (obtained from a selection) intersected with a particular node within an HTML document, which is a relatively common scenario when developing WYSWIYG editors. Mozilla’s implementation of Range used to have a proprietary
intersectsNode method, which was ideal. However, they’ve removed this in Gecko 1.9 (and therefore Firefox 3) and provided an example function that does the same job. Unfortunately this function doesn’t work in WebKit (and hence Safari and Chrome) because of a bug in WebKit: they seem to have managed to invert the behaviour of
START_TO_END. Tsk. So I’ve modified the Mozilla example to work consistently with all browsers that support
Range Continue reading
eval on the iframe window object. Which predictably worked fine in Firefox and Opera 8+, but did nothing in IE, which seemed to be missing the eval method on the iframe.
I do quite a lot of work on Intranets, on which the only browser in use is Microsoft Internet Explorer. This often means that IE-specific tricks can be used safely on the Intranet. This specific trick is for using IE with Outlook.
I read on MSDN about how to include line breaks in the body of an email created via a
mailto: link, when opening the mailto using Outlook Express (and Outlook).
However, this was causing some problems for users with IE5.0. Turns out there’s a problem in IE 5.0 with this approach. IE 5.0 doesn’t correctly translate these line breaks into Outlook.