Skip to content

Commit

Permalink
更安全地使用htmlParser
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Dec 6, 2012
1 parent 3e84a9e commit 80b2b3c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ define( "node", "mass,$support,$class,$query,$data".split(","),function( $ ){
if ( typeof expr === "string" ) {
doc = this.ownerDocument = !context ? document : getDoc( context, context[0] );
var scope = context || doc;
expr = expr.trim();
if ( expr.charAt(0) === "<" && expr.charAt( expr.length - 1 ) === ">" && expr.length >= 3 ) {
nodes = $.parseHTML( expr, doc );//分支5: 动态生成新节点
nodes = nodes.childNodes
Expand Down

0 comments on commit 80b2b3c

Please sign in to comment.