Posts

Showing posts from February, 2011

...btw, getters & setters for IE 6, 7, and 8 (almost!) : Object.createStatic

Image
Update Yes, I did it: getters and setters for IE < 9 and other browsers Update apparently Dojo framework explored this stuff before me Re-Update: More limitations!!! Apparently I have said "Hooray!" too early, @_bga told me that this way is compatible with primitives only since the moment we have a property with an object or a function, this will converted into string. So: don't return objects or functions since these will not work as expected! Well, still something tho ... I should probably change the title with a big "almost" ... ... pretty much, the " dream comes true " features that could open hundreds of doors for current Web development status is here, but before we can understand properly the example page , we surely need a bit of introduction about the topic ... Getters/Setters For Everybody! Getters and Setters are beautiful, powerful, and the ideal scenario for whatever developer behind any sort of API. Getters and Setters work perfect...

NEW YORK RULES

Image
The New York Rules cassette comp is finally out. You can order it here - http://www.burnbooks.org We will have copies to sell at shows soon enough as well.

All You Need for JSONP

I have just uploaded a truly simple, still robust, function able to do generic JSONP without pretending too much magic. The concept is simple, we pass the url, including the parameter name used to communicate the callback name, and a callback as second argument ... that's it, 202 216 bytes minified and gzipped ( many thanks @jdalton for the catch ) Here an example: <!-- the generic HTML page --> <script src="JSONP.js"></script> <script> this.onload = function () { var many = 0; JSONP("test.php?callback", function (a, b, c) { this.document.body.innerHTML += [ a, b, ++many, c ].join(" ") + "<br />"; }); JSONP("test.php?callback", function (a, b, c) { this.document.body.innerHTML += [ a, b, ++many, c ].join(" ") + "<br />"; }); }; </script> And here the testable demo result that should work with every bloody damned browser. What's on the server? No...