When custom attributes conflict with validation
I must confess, I am not a validation freak. Semantics and pixel perfection are my primary goals. Forgetting to specify a “type” on a javascript is not the biggest crime.
However I went ahead and validated the page I made for this telecom major. A social media campaign microsite which we created in five using restful calls and jquery in the front.
Back to validation, 11 validation errors awaited me, apart from the missing “type” attributes, I had custom attributes, ouch!
I was using those attributes among others for parameters, Ajax url’s. I knew the solution was a custom DTD, I remembered from a previous oroject where we had used adobe spry widgets, the software would drop a custom namespace on top of the header. Searching on the adobe site I figured that they had a tough time too and suggested having a entity tag in the header for the valufator and remove it when going to production.
Code samples in my case are in the next post.
Oh and other than that I had a custom live chat code that had reserved keywords and unescaped characters.
So what did I do? read my next post for the answer.
Simulating the Click Event on Firefox
1 2 3 4 5 6 7 8 9 10 11 12 | if(navigator.appName.indexOf("Explorer")== -1) { // Simulates the click() event for gecko based browsers HTMLElement.prototype.click = function() { var evt = this.ownerDocument.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this.dispatchEvent(evt); } } |
Source : Unknown
Drop me a line and I will provide credit
OuterHTML snippet
Here is a simple snippet that enables OuterHTML in Firefox.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | if (document.body.__defineGetter__) { if (HTMLElement) { var element = HTMLElement.prototype; if (element.__defineGetter__) { element.__defineGetter__("outerHTML", function () { var parent = this.parentNode; var el = document.createElement(parent.tagName); el.appendChild(this); var shtml = el.innerHTML; parent.appendChild(this); return shtml; } ); } } } |
Originial Credit : Snipplr
Blogging via the iphone widget
This is just great to be able to blog while in your iphone
Compressor Rater - The Javascript Compression rater.
I like comparisons and especially when a tool takes my input and produces 3 different
Step in Compressor Rater it takes the Dojo Shrinker, JSMin and YUI compressors for Javascript and produces a report as well as gives you an option to copy paste the resulting code.
Of Jumping Cows and Energy Domes.
Both Jquery and Mootools are great libraries, however one must win. Is it the Cow or the Dome, find out as I compare both these libraries feature by feature.
But why now?, Mootools has just released their 1.2 version which boasts of a HashMap for clientside objects.
Jquery has seen a 1.2.1 version ( sounds familiar?, look above) for a month now.
Why dont you subscribe to the feed to be the first one to hear about it.
The case of lost children - CSS 3 and Why you should care about it.
A while back I had this post about support for CSS3 in IE7. With a growing share of 23% and a mission to make this version automatically available to all users of Windows XP, IE7 still seems to have got it wrong for the developer.
The CSS3 frustration continues, for e.g: the “last-child” selector, could have been a boon to site designers. The trailing “class=last” that’s added to every last item of a list, the last cell of a row could have been on the way out for once and all.
The “last-child” selector is a easy way of targeting the last element of any dom node collection. This is great for any last item of a list where you dont want that seperator to appear. MS doesn’t seem to realize that just doing half baked work with “first-child” doesn’t cut it.
Jquery is faster in the Mootools SlickSpeed Test.
Mootools has a great speed test for DOM selectors in JS libraries called the “SlickSpeed” test. The results compare “Mootools “, “Prototype ” and “Jquery“. In the instance that I ran ( I only clicked “Start Tests”!) , Jquery came in first.
Jquery is on the third column in the attached thumbnail.
Its also interesting to note that “prototype” finds no results for the CSS selector (”div:nth-child(even)” and “div:nth-child(odd)”).
[tags]jquery, mootools [/tags]
Understanding why Communities are Important.
When you work as part of a large company, there is an overabundance of similar experienced people. While this might appear as competive to many, to some its an opportunity to form a community…
Click to continue reading “Understanding why Communities are Important.”
5 tricks on Jquery.
Jquery is as usual the best you can get with plugins as well as the sheer joy of writing short and sweet. In this post I talk about 5 re-used Jquery snippets across projects. Some of this may not be news to you, but for some it might just make you a “jfan”