Sha256: 68cda2bcbfd3ed306aaa669dc9a1b3520879c0578a340e7e78f0b9753276c0b0
Contents?: true
Size: 826 Bytes
Versions: 7
Compression:
Stored size: 826 Bytes
Contents
/* --- script: Elements.From.js name: Elements.From description: Returns a collection of elements from a string of html. license: MIT-style license authors: - Aaron Newton requires: - Core/String - Core/Element - /MooTools.More provides: [Elements.from, Elements.From] ... */ 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(); };
Version data entries
7 entries across 7 versions & 1 rubygems