티스토리 뷰

//Using hasOwnProperty to build resilient object looping.
Object.prototype.otherKey = "otherValue";
var object = { key: "value" };
for ( var prop in object ) {
    if ( object.hasOwnProperty( prop ) ) {
        assert( prop, "key","There should only be one iterated property." );
    }
}

//XPath
if ( typeof document.evaluate === "function" ) {
    function getElementsByXPath(expression, parentElement) {
        var results = [];
        var query = document.evaluate(expression,parentElement || document,null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        for (var i = 0, length = query.snapshotLength; i < length; i++)
            results.push(query.snapshotItem(i));
        return results;
    }
}


댓글
D-DAY
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함