cross-browser

Replacement for DOM3 getUserData/setUserData methods

旧城冷巷雨未停 提交于 2020-01-04 11:43:33
问题 So we've got some old-school Firefox extension code that uses the DOM3 methods get/setUserData() to pass around data in the DOM. Unfortunately, these have been deprecated in DOM4, so Firefox is planning to drop support for them, and Chrome never supported them in the first place. Is there a cross-browser replacement? jQuery's $.data seems to be an option, but 'pure' JavaScript would be preferable. 回答1: So in the end we decided to go with jQuery after all, the core library is only around 75k

Replacement for DOM3 getUserData/setUserData methods

帅比萌擦擦* 提交于 2020-01-04 11:43:09
问题 So we've got some old-school Firefox extension code that uses the DOM3 methods get/setUserData() to pass around data in the DOM. Unfortunately, these have been deprecated in DOM4, so Firefox is planning to drop support for them, and Chrome never supported them in the first place. Is there a cross-browser replacement? jQuery's $.data seems to be an option, but 'pure' JavaScript would be preferable. 回答1: So in the end we decided to go with jQuery after all, the core library is only around 75k

Javascript/jQuery outerHeight()

非 Y 不嫁゛ 提交于 2020-01-04 09:14:26
问题 Does $('#idOfLememt').outerHeight(); yield same result for all browsers? Any thing different for IE7? 回答1: Just go to http://api.jquery.com/outerHeight/ with the different browsers you want to test and see for yourself (on Mac OS X so can't check IE for you). It looks like the DOM in the demo has all possible styles that would affect this included. Most of the time you can rely on jQuery to do it's thing and give you consistent results across browsers, that's one of it's main reasons for

IE: window.open returning null

白昼怎懂夜的黑 提交于 2020-01-04 06:22:48
问题 on a click event, I am running this code: win = window.open(a.href); i = setInterval(function () { if (win.closed) { /* do things */ } }, 250); this works fine in Firefox and Chrome, but in IE (9) it says that win is undefined or null. How can I work around this? EDIT: The window IS opened correctly in IE, it's just that a reference to it is not saved in win like it is in Firefox/Chrome. 回答1: Add name to the window: win = window.open(a.href, "myWin"); 来源: https://stackoverflow.com/questions

Styling Radio Inputs

前提是你 提交于 2020-01-04 04:00:32
问题 So I'm having major trouble with styling radio buttons and as such I've managed to get it working perfectly in Chrome, a tiny bit in Firefox and not at all in IE. This is the expected look (in Chrome): This is how it looks in Firefox: And IE... I've got a JSFiddle for you guys to play around with, but I just can't seem to figure out how to get this working cross-browser. Any ideas? JSFiddle: http://jsfiddle.net/s5rpd97b/ Obligatory paste of code despite the fact it's on JSFiddle anyway: HTML:

Capture the enter key cross-browser, my solution isn't working

痴心易碎 提交于 2020-01-04 03:57:08
问题 I have what I thought was a cross-browser solution to capturing the enter key in a chat script I'm making, here it is: nn=(document.layers)?true:false; ie=(document.all)?true:false; function keyDown(e) { var evt=(e)?e:(window.event)?window.event:null; if(evt){ var key=(evt.charCode)?evt.charCode: ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0)); if(key=="13") document.getElementById('chatEnter').submit(); } } document.onkeydown=keyDown; if(nn) document.captureEvents(Event.KEYDOWN); I got

Underscore.string browser support

此生再无相见时 提交于 2020-01-04 03:51:25
问题 Underscore.string seems to provide nice features for javascript string manipulation. It seems to have all the good points: license : MIT dependencies : none, it is an extension for Underscore.js but it can be used as standalone, without underscore.js weight (minified & gzipped): 4KB community, contributors: 58 contributors on Github history, contributions: since mid 2010 on Github, contributions seem rather stable although pretty quiet since 2014 Except one point for which I am missing info:

Minimum CSS required for gradients IE8+

廉价感情. 提交于 2020-01-04 02:32:06
问题 Usually when I make a gradient I use the colorzilla gradient edtior. By default it generates the CSS for you. Here is an example: background: #1e5799; /* Old browsers */ background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top,

addEventListener working in firefox but not in chrome

懵懂的女人 提交于 2020-01-04 01:46:21
问题 The given code works in Mozilla Firefox 31.0 but not in Google Chrome 38.0.2125.104 How can this issue be solved? Please Note : Using the change() function or jQuery is not an option here! <body> <select id="category"> <option value="movies">Movies</option> <option value="artist">Artists</option> <option value="authors">Authors</option> <option value="chemistry">Chemistry</option> </select> </body> <script> window.onload = initialise; function initialise() { var options = document

creating a cookie failing with safari, chrome, ie but working with FF

允我心安 提交于 2020-01-03 20:55:55
问题 We are using the following code to create the security cookie. Everything works fine in Staging environment, however in the production environment the following code is unable to create a cookie in Safari, Chrome or IE but it does create a cookie successfully in Firefox. anything that you guys think i am missing or is wrong in here ? public static void SetAuthenticationCookie(CustomIdentity identity) { ConfigSettings configSettings = ConfigHelper.GetConfigSettings(); string cookieName =