1
이 스크립트는 jsdom과 jquery를 사용하여 태그의 href 속성 값을 가져옵니다. 어떤 이유로 든 스크립트를 실행하는 경로와 관련하여 정규화 된 경로를 사용합니다. 어떻게 을 얻을 수 있습니까?은 정규화되지 않은 href 값입니까?JQuery를 사용할 때 jsdom 자동 href 결과를 어떻게 멈추게합니까?
var currentDoc = jsdom.jsdom('<html><head><title>href test</title></head><body><p><a href="test.html">Test</a></p></body></html>';, null, {});
var window = currentDoc.createWindow();
jsdom.jQueryify(window, 'jquery-1.4.2.min.js' , function() {
console.log(window.$('a')[0]['href']);
});
(https://gist.github.com/2355968에서 또한 코드)