Update parser.js

IE7中不支持string[index]的用法改用slice做兼容
This commit is contained in:
chengbapi
2015-08-04 15:32:27 +08:00
parent 55924144c6
commit df0b76992d

View File

@@ -20,8 +20,8 @@ function getTagName (html) {
var tagName = html.slice(1, i + 1);
}
tagName = _.trim(tagName).toLowerCase();
if (tagName[0] === '/') tagName = tagName.slice(1);
if (tagName[tagName.length - 1] === '/') tagName = tagName.slice(0, -1);
if (tagName.slice(0, 1) === '/') tagName = tagName.slice(1);
if (tagName.slice(-1) === '/') tagName = tagName.slice(0, -1);
return tagName;
}