首页 > Web开发 > 详细

htmlparser2#Tokenizer.prototype._stateInNamedEntity bug

时间:2014-12-01 17:35:42      阅读:307      评论:0      收藏:0      [点我收藏+]

source:

Tokenizer.prototype._stateInNamedEntity = function(c){
        if(c === ";"){
                this._parseNamedEntityStrict();
                if(this._sectionStart + 1 < this._index && !this._xmlMode){
                        this._parseLegacyEntity();
                }
                this._state = this._baseState;
        } else if((c < "a" || c > "z") && (c < "A" || c > "Z") && (c < "0" || c > "9")){
                if(this._xmlMode);
                else if(this._sectionStart + 1 === this._index);
                else if(this._baseState !== TEXT){ 
                        if( c !== "="){
                                this._parseNamedEntityStrict();  // this is a bug line.
                       }
                } else {
                        this._parseLegacyEntity();
                }
                this._state = this._baseState;
                this._index--;
        }
};

input: &trade_type=xxx,  the  c is "_",
output: ?type=xxx

fix: if((c < "a" || c > "z") && (c < "A" || c > "Z") && (c < "0" || c > "9"))
and  c !== "="
do nothing!

htmlparser2#Tokenizer.prototype._stateInNamedEntity bug

原文:http://blog.csdn.net/axman/article/details/41649923

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!