Requires

Provides

Elements.From.js

Returns a collection of elements from a string of html.

License:
MIT-style license
Authors:
Aaron Newton
  1. 26
  2. 27
  3. 28
  4. 29
  5. 30
  6. 31
  7. 32
  8. 33
  9. 34
  10. 35
  11. 36
  12. 37
  13. 38
  14. 39
  15. 40
  16. 41
Elements.from = function(text, excludeScripts){ if (excludeScripts || excludeScripts == null) text = text.stripScripts(); var container, match = text.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i); if (match){ container = new Element('table'); var tag = match[1].toLowerCase(); if (['td', 'th', 'tr'].contains(tag)){ container = new Element('tbody').inject(container); if (tag != 'tr') container = new Element('tr').inject(container); } } return (container || new Element('div')).set('html', text).getChildren(); };