Category Archives: JavaScript Snippets

E4X DOM Toolkit

I have created a small JavaScript toolkit named e4x-dom.js for making it easy to manipulate the DOM with E4X. The following methods are implemented on XML objects by e4x-dom.js: node() Returns the HTML node representation of the XML. over(element or … Continue reading

Posted in JavaScript, JavaScript Libraries, JavaScript Snippets | Tagged , | View Comments

Object.getPrototypeOf

The addition of Object.getPrototypeOf in JavaScript 1.8.1 reminded me of John Resig’s Object.getPrototypeOf implementation that uses constructor property even if it has been modified. If the constructor property has been modified, it can be reset by deleting the property. An … Continue reading

Posted in JavaScript, JavaScript Snippets | Tagged | Comments Off

textContent in IE8

I was creating a testcase for a bug that is present in every browser and I noticed IE still doesn’t support textContent as of IE8. I don’t like having to make code that supports both innerText and textContent so I … Continue reading

Posted in JavaScript, JavaScript Snippets | Tagged , , , | Comments Off

Reusable pmxdr Instances

I just released version 0.0.4 of the pmxdr client code to support reusable instances where the same iframe can be used for mutiple pmxdr requests to a domain. It’s still the same interface, but you need to call pmxdr.request() instead … Continue reading

Posted in JavaScript, JavaScript Libraries, JavaScript Snippets | Tagged | Comments Off

Custom Error Constructors

Most of the time, the standard six native error constructors and the one generic error constructor are not specific enough for an error. What if you want your library to throw a custom SecurityError if it detects an XSS vector … Continue reading

Posted in Hacks, JavaScript, JavaScript Snippets | Tagged , | Comments Off