You are not logged in.
Pages: 1
Can anyone explain what the GetHtml plugin actually does and why or if one should use it?
One thing I noticed (actually my boss) and I found a little distrcting that it gives links some empty attributes (target, title) which make the document not validate
Offline
- its much faster than the old functions
- the old code stripped out very often some html-code
- it produces more xhtml-valid code (eg <img /> instead of <img>)
- it doesn't destroy JavaScript and Flash (don't know how well this is currently working)
- however it might have more bugs as it is not that well tested
Niko
Offline
InnerHTML returns all the html under a given node in the document, not including the tag for the node itself. OuterHTML is an IE-only property that returns the html including the tag for the node.
As to the initial observation about empty attributes, it's not that GetHtml inserts them, but rather they are inserted by the _createLink function and GetHtml fails to remove them the way the built-in getHTML does. Changing these lines in _createLink:
a.target = param.f_target.trim();
a.title = param.f_title.trim();
to
if(param.f_target != '') a.target = param.f_target;
else a.removeAttribute("target");
if(param.f_title != '') a.title = param.f_title;
else a.removeAttribute("title");
would be one way to fix it, but it probably would be a good idea to strip empty attributes in GetHtml anyway. I'll look at doing that, just one more regular expression....
Offline
Pages: 1