Created
April 26, 2014 02:06
-
-
Save KJlmfe/11309881 to your computer and use it in GitHub Desktop.
JavaScript 设计模式 - Facade(外观模式/门面模式)-封装浏览器差异
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myevent = { | |
// ... | |
stop: function (e) { | |
//其他 | |
if(typeof e.preventDefault === "function") { | |
e.preventDefault(); | |
} | |
if(typeof e.stopPropagation === "function") { | |
e.stopPropagation(); | |
} | |
//IE | |
if(typeof e.returnValue === "boolean") { | |
e.returnValue = false; | |
} | |
if(typeof e.cancelBubble === "boolean") { | |
e.cancelBubble = true; | |
} | |
} | |
// ... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment