Skip to content

Commit 69c4d37

Browse files
committed
cleanup
1 parent beebc99 commit 69c4d37

File tree

4 files changed

+10
-55
lines changed

4 files changed

+10
-55
lines changed

dist/tigerjs/tiger_min.js

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/iterator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ TigerJS.Iterator = function (elements) {
793793
* @function
794794
*/
795795
this.obj.index_of = function(x){
796-
return this.obj.indexOf(x);
796+
return this.indexOf(x);
797797
} //migrating;
798798

799799
/**

src/tiger.js

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,52 +1912,9 @@ var TigerJS = function () {
19121912
*/
19131913

19141914
this.create = function (content) {
1915-
var re_match = [],
1916-
//this regexp also takes care of cases where the tag is broken with a new line or feed
1917-
re = new RegExp("<([a-z]+\s*)?\s*.*?\s*>\n*\t*\f*\r*(.*?)<\s*/\s*[a-z]*>\*\n*\t*\f*\r*", "gim"),
1918-
re_empty = new RegExp("<([img | hr | br | meta | link | embed]+\s*)?([.])+/>", "gi"), //match empty tags, must be xhtml/xml//
1919-
re_empty_match = [],
1920-
temp_div, html = "",
1921-
tag = tag || "div",
1922-
i;
1923-
content = content.trim();
1924-
do {
1925-
///match empty tags
1926-
re_empty_match[re_empty_match.length] = re_empty.exec(content);
1927-
} while (re_empty_match[re_empty_match.length - 1]);
1928-
//strip out empty tags
1929-
content = content.replace(re_empty, "");
1930-
do { ///match regular tags
1931-
re_match[re_match.length] = re.exec(content); //
1932-
1933-
} while (re_match[re_match.length - 1]);
1934-
1935-
//am creating an Iterator and compacting it cause' during the process some array indices got null or undefined
1936-
//or just magically dissapeared
1937-
//TODO, whats causing this
1938-
re_match = T.Iterator(re_match.concat(re_empty_match)).
1939-
compact(); //addup all the results and create the node
1940-
1941-
1942-
//first we use a div as a place holder for all matched elements
1943-
temp_div = document.createElement(tag);
1944-
for (i = 0; i < re_match.length; i++) {
1945-
temp_div.innerHTML += re_match[i][0];
1946-
1947-
}
1948-
1949-
html = document.createDocumentFragment(); //fragment to hold All nodes to be appended
1950-
1951-
for (i = 0; i < temp_div.childNodes.length; i++) {
1952-
//without cloning nodes here error occurs while appending paragraph element, not sure Y!, ok it seems its
1953-
//some standard DOMException, or heirachy issue, well we have a solution
1954-
1955-
html.appendChild(temp_div.childNodes.item(i).cloneNode(true));
1956-
}
1957-
1958-
1959-
temp_div = null;
1960-
return html; //return the created nodes
1915+
1916+
return document.createRange().createContextualFragment? //return the created nodes
1917+
document.createRange().createContextualFragment(content): (new DOMParser()).parseFromString(content, 'text/html').body.firstChild; //return the created nodes
19611918

19621919

19631920
};

0 commit comments

Comments
 (0)