jQuery 및 Prototype과 같은 널리 사용되는 JavaScript 라이브러리에서 (단일) 달러 기호 사용을 이해합니다. 또한 PHP (가변 변수)에서 이중 달러 기호의 중요성을 이해합니다. 딘 에드워즈는 유명한 더블 달러 기호 addEvent() JavaScript 기능을 사용합니다. 그 기준은 크게 인해 오늘을 무시하고 있지만,JavaScript 더블 달러 기호
내가 읽은 바로는function addEvent(element, type, handler) {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
};
// a counter used to create unique IDs
addEvent.guid = 1;
, 달러 기호는 공식적으로 코드 생성 도구 자바 스크립트에서 의미가있다 : 여기에 이중 달러 기호의 사용을 포함 제외입니다 앞서 언급 한 JavaScript 라이브러리에서 달러 기호가 널리 사용됩니다.
JavaScript로 이중 달러 기호를 사용하는 사람이라면 누구에게 알려줄 수 있습니까?
대단히 감사합니다.
'addEvent'가 IE에서 체처럼 누출 나에게 보인다. – kangax