shim

cross browser compare document position

核能气质少年 提交于 2019-12-07 03:13:01
问题 DOM4 compareDocumentPosition I want to implement compareDocumentPosition. Resig has made a great start at doing just this. I've taken his code and neatened it up function compareDocumentPosition(other) { var ret = 0; if (this.contains) { if (this !== other && this.contains(other)) { ret += 16; } if (this !== other && other.contains(this)) { ret += 8; } if (this.sourceIndex >= 0 && other.sourceIndex >= 0) { if (this.sourceIndex < other.sourceIndex) { ret += 4; } if (this.sourceIndex > other

jQuery: Problem with windowed controls in IE6

做~自己de王妃 提交于 2019-12-06 10:29:24
I have a web page which contains a select box. When I open a jQuery Dialog it is displayed partly behind the select box. How should I approach this problem? Should I hide the select box or does jQuery offer some kind of 'shim' solution. (I have Googled but didn't find anything) Here is some code: <!DOCTYPE html> <html lang="en"> <head> <title>testJQuery</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta name="GENERATOR" content="Rational Application Developer"> <link rel="stylesheet" href="theme/smooth/theme.css" type="text/css" media="screen" /> </head>

cross browser compare document position

若如初见. 提交于 2019-12-05 08:07:06
DOM4 compareDocumentPosition I want to implement compareDocumentPosition. Resig has made a great start at doing just this . I've taken his code and neatened it up function compareDocumentPosition(other) { var ret = 0; if (this.contains) { if (this !== other && this.contains(other)) { ret += 16; } if (this !== other && other.contains(this)) { ret += 8; } if (this.sourceIndex >= 0 && other.sourceIndex >= 0) { if (this.sourceIndex < other.sourceIndex) { ret += 4; } if (this.sourceIndex > other.sourceIndex) { ret += 2; } } else { ret += 1; } } return ret; } This works for Element but does not for

Require.JS shim config global scope?

廉价感情. 提交于 2019-12-04 15:48:29
问题 I have following setup for requireJS. requirejs.config({ paths: { 'resources' : '/Scripts/resources' }, shim: { 'resources': { exports: 'LocalizedStrings' } } }); And my resources.JS look like following: LocalizedStrings = { title: "Demo", save: "Save" } Now when I load resources as a dependency in main.JS file I can access LocalizedStrings and it works. //main.js define(function(require){ var LocalizedStrings = require('resources'); console.log(LocalizedStrings); //works as expected });

How do you add polyfills to Globals in typescript (modules)

倾然丶 夕夏残阳落幕 提交于 2019-12-04 03:16:57
问题 I was able to find a polyfill(on stack overflow) for Array#includes and add it to typescript but after adding a small import to my file it turned into a module(I understand why they do this for export, but why on import) and I couldn't modify the global namespace anymore. How do I fix the polyfill? interface Array<T> { includes(searchElement: T) : boolean; } // Add Array includes polyfill if needed // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

Loading jQuery, Underscore and Backbone using RequireJS 2.0.1 and shim

 ̄綄美尐妖づ 提交于 2019-12-02 14:10:38
I am experimenting a little bit with RequireJS 2.0.1 . My goal is to load correctly jQuery, Underscore and Backbone. From the original RequireJS doc I discovered that the author J. Burke added (to this new release) a new config option called shim . Then I wrote this stuff down here: index.html <!DOCTYPE html> <html> <head> <title>Testing time</title> <script data-main="scripts/main" src="scripts/require.js"></script> </head> <body> <h1>Testing time</h1> </body> </html> scripts/main.js requirejs.config({ shim: { 'libs/jquery': { exports: '$' }, 'libs/underscore': { exports: '_' }, 'libs

Acceptable CSS hacks/fixes

我的未来我决定 提交于 2019-11-30 09:35:45
Is there a list of 'good' clean CSS hacks, which are certain to be future-proof? For example, zoom:1 is safe, as long as it's only served to IE, and you remember it's there. The very common hack of using child selectors is not safe because IE7 supports them. Using height:1% just feels dirty (but that might just be me). I know of ie7-js , so IE6 bugs don't worry me much. Also, I'm not looking for a religious debate, just sources. Thanks for the replies - I've selected the one with best sources as answer. Thanks also for the suggestions to use separate CSS files, or not to worry about it. I

ShimNotSupportedException in MS VisualStudio 2012

和自甴很熟 提交于 2019-11-30 09:02:23
问题 I'm just trying to get familiar with the new Fakes Isolation Framework in Visual Studio 2012 RC but I'm consequently facing issues with ShimNotSupportedException s. At the first tries, each single shim method I tried to hook up a delegate to, had thrown a ShimNotSupportedException when trying to run/debug the test. [TestMethod] public void GetFoo_ValidBar_ReturnsBaz() { using(ShimsContext.Create()) { ShimDateTime.NowGet = () => new DateTime(2012,08,11,10,20,59); const string expected =

What is a Shim?

你说的曾经没有我的故事 提交于 2019-11-29 18:55:48
What's the definition of a Shim? From Wikipedia: In computer programming, a shim is a small library that transparently intercepts an API, changing the parameters passed, handling the operation itself, or redirecting the operation elsewhere. Shims typically come about when the behaviour of an API changes, thereby causing compatibility issues for older applications that still rely on the older functionality. In these cases, the older API can still be supported by a thin compatibility layer on top of the newer code. Shims can also be used to run programs on different software platforms than they

ShimNotSupportedException in MS VisualStudio 2012

陌路散爱 提交于 2019-11-29 11:02:38
I'm just trying to get familiar with the new Fakes Isolation Framework in Visual Studio 2012 RC but I'm consequently facing issues with ShimNotSupportedException s. At the first tries, each single shim method I tried to hook up a delegate to, had thrown a ShimNotSupportedException when trying to run/debug the test. [TestMethod] public void GetFoo_ValidBar_ReturnsBaz() { using(ShimsContext.Create()) { ShimDateTime.NowGet = () => new DateTime(2012,08,11,10,20,59); const string expected = "20120811_102059"; string actual = GetFoo(); Assert.AreEqual(expected,actual); } } This is the corresponding