src/LiveDevelopment/Agents/DOMHelpers.js
function _findTag(src, skip) {
        var from, to, inc;
        from = _find(src, [/<[a-z!\/]/i, 2], skip);
        if (from < 0) {
            return null;
        }
        if (src.substr(from, 4) === "<!--") {
            // html comments
            to = _find(src, "-->", from + 4);
            inc = 3;
        } else if (src.substr(from, 7).toLowerCase() === "<script") {
            // script tag
            to = _find(src.toLowerCase(), "</script>", from + 7);
            inc = 9;
        } else if (src.substr(from, 6).toLowerCase() === "<style") {
            // style tag
            to = _find(src.toLowerCase(), "</style>", from + 6);
            inc = 8;
        } else {
            to = _find(src, ">", from + 1, true);
            inc = 1;
        }
        if (to < 0) {
            return null;
        }
        return {from: from, length: to + inc - from};
    }
function _findTag(src, skip) {
        var from, to, inc;
        from = _find(src, [/<[a-z!\/]/i, 2], skip);
        if (from < 0) {
            return null;
        }
        if (src.substr(from, 4) === "<!--") {
            // html comments
            to = _find(src, "-->", from + 4);
            inc = 3;
        } else if (src.substr(from, 7).toLowerCase() === "<script") {
            // script tag
            to = _find(src.toLowerCase(), "</script>", from + 7);
            inc = 9;
        } else if (src.substr(from, 6).toLowerCase() === "<style") {
            // style tag
            to = _find(src.toLowerCase(), "</style>", from + 6);
            inc = 8;
        } else {
            to = _find(src, ">", from + 1, true);
            inc = 1;
        }
        if (to < 0) {
            return null;
        }
        return {from: from, length: to + inc - from};
    }
function _findTag ( src , skip ) { var from , to , inc ; from = _find ( src , [ / <[a-z!\/] / i , 2 ] , skip ) ; if ( from < 0 ) { return null ; } if ( src . substr ( from , 4 ) === "<!--" ) { // html comments to = _find ( src , "-->" , from + 4 ) ; inc = 3 ; } else if ( src . substr ( from , 7 ) . toLowerCase ( ) === "<script" ) { // script tag to = _find ( src . toLowerCase ( ) , "</script>" , from + 7 ) ; inc = 9 ; } else if ( src . substr ( from , 6 ) . toLowerCase ( ) === "<style" ) { // style tag to = _find ( src . toLowerCase ( ) , "</style>" , from + 6 ) ; inc = 8 ; } else { to = _find ( src , ">" , from + 1 , true ) ; inc = 1 ; } if ( to < 0 ) { return null ; } return { from : from , length : to + inc - from } ; }
Find the next tag
@param {string} source string
@param {integer} ignore characters before this offset
Find the next tag