Tag: web
-
Comparing nodes
I thought I wanted to compare the DOM trees for a couple of nodes. I ended up putting this together: How would you have done it? (I’d be unsurprised if this has some bugs.) After writing this though, I realized that comparing the HTML from n1.getHTML() vs n2.getHTML() was better for my purposes. (I don’t…
-
white-space: pre-line converts lines into spaces in Safari when pasting into a textarea
In a site I’m helping with, we encountered this weird behavior: users pasting multiline text into a textarea in Safari (but *not* in Chrome) found their newlines replaced with spaces. This was a problem because lines are used to separate items to be processed. Dropping the lines garbled the meaning of the input. My first…