Skip to content

Commit e078195

Browse files
author
dean.edwards
committed
Version 2.1 (beta4)
1 parent 2e7198f commit e078195

12 files changed

+151
-115
lines changed

lib/IE7.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/IE8.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/IE9.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ie7-squish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
--------------------------------------------------------------------- */
1010

11-
// @NOTE: ie7Layout.boxSizing is the same as the "Holly Hack"
11+
// NOTE: IE7.Layout.boxSizing is the same as the "Holly Hack"
1212

1313
if (IE7.loaded && IE7.appVersion < 7) {
1414

lib/src/IE7.js

+32-24
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
Ingo Chao
1818
*/
1919

20-
// timestamp: Sun, 07 Mar 2010 18:13:50
20+
// timestamp: Fri, 30 Apr 2010 20:59:18
2121

2222
(function(window, document) {
2323

2424
var IE7 = window.IE7 = {
25-
version: "2.1(beta3)",
25+
version: "2.1(beta4)",
2626
toString: K("[IE7]")
2727
};
2828
IE7.compat = 7;
@@ -841,7 +841,10 @@ var StyleSheet = Base.extend({
841841
if (media === "all" || media === self.media) {
842842
// IE only allows importing style sheets three levels deep.
843843
// it will crash if you try to access a level below this
844-
if (level < 3 && styleSheet.cssText) {
844+
try {
845+
var canAcess = !!styleSheet.cssText;
846+
} catch (exe) {}
847+
if (level < 3 && canAcess) {
845848
var hrefs = styleSheet.cssText.match(IMPORTS);
846849
// loop through imported style sheets
847850
for (var i = 0, imported; i < styleSheet.imports.length; i++) {
@@ -934,7 +937,14 @@ var StyleSheet = Base.extend({
934937
},
935938

936939
parse: function() {
937-
this.cssText = IE7.CSS.parser.parse(this.cssText);
940+
var cssText = IE7.CSS.parser.parse(this.cssText);
941+
942+
var declarations = "";
943+
this.cssText = cssText.replace(/@charset[^;]+;|@font\-face[^\}]+\}/g, function(match) {
944+
declarations += match + "\n";
945+
return "";
946+
});
947+
this.declarations = decode(declarations);
938948

939949
// Parse the style sheet
940950
var offset = IE7.CSS.rules.length;
@@ -963,7 +973,7 @@ var StyleSheet = Base.extend({
963973
},
964974

965975
toString: function() {
966-
return "@media " + this.media + "{" + this.cssText + "}";
976+
return this.declarations + "@media " + this.media + "{" + this.cssText + "}";
967977
}
968978
});
969979

@@ -1132,25 +1142,23 @@ var DynamicPseudoClass = Base.extend({
11321142
// dynamic pseudo-classes
11331143
// -----------------------------------------------------------------------
11341144

1135-
if (appVersion < 7) {
1136-
var Hover = new DynamicPseudoClass("hover", function(element) {
1137-
var instance = arguments;
1138-
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1139-
Hover.register(instance);
1140-
});
1141-
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1142-
Hover.unregister(instance);
1143-
});
1145+
var Hover = new DynamicPseudoClass("hover", function(element) {
1146+
var instance = arguments;
1147+
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1148+
Hover.register(instance);
11441149
});
1145-
1146-
// globally trap the mouseup event (thanks Martijn!)
1147-
addEventHandler(document, "onmouseup", function() {
1148-
var instances = Hover.instances;
1149-
for (var i in instances)
1150-
if (!instances[i][0].contains(event.srcElement))
1151-
Hover.unregister(instances[i]);
1150+
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1151+
Hover.unregister(instance);
11521152
});
1153-
}
1153+
});
1154+
1155+
// globally trap the mouseup event (thanks Martijn!)
1156+
addEventHandler(document, "onmouseup", function() {
1157+
var instances = Hover.instances;
1158+
for (var i in instances)
1159+
if (!instances[i][0].contains(event.srcElement))
1160+
Hover.unregister(instances[i]);
1161+
});
11541162

11551163
var ATTR = {
11561164
"=": "%1==='%2'", // "[@%1='%2']"
@@ -1181,8 +1189,8 @@ var FILTER = {
11811189

11821190
// PSEDUO
11831191
":first-child": "!" + PREVIOUS_SIBLING + "&&",
1184-
":link": "e.href&&(e.nodeName==='A'||e.nodeName==='AREA')&&",
1185-
":visited": "false&&" // not implemented (security)
1192+
":link": "e.currentStyle['ie7-link']=='link'&&",
1193+
":visited": "e.currentStyle['ie7-link']=='visited'&&"
11861194
};
11871195

11881196
// =========================================================================

lib/src/IE8.js

+32-24
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
Ingo Chao
1818
*/
1919

20-
// timestamp: Sun, 07 Mar 2010 18:13:50
20+
// timestamp: Fri, 30 Apr 2010 20:59:18
2121

2222
(function(window, document) {
2323

2424
var IE7 = window.IE7 = {
25-
version: "2.1(beta3)",
25+
version: "2.1(beta4)",
2626
toString: K("[IE7]")
2727
};
2828
IE7.compat = 8;
@@ -841,7 +841,10 @@ var StyleSheet = Base.extend({
841841
if (media === "all" || media === self.media) {
842842
// IE only allows importing style sheets three levels deep.
843843
// it will crash if you try to access a level below this
844-
if (level < 3 && styleSheet.cssText) {
844+
try {
845+
var canAcess = !!styleSheet.cssText;
846+
} catch (exe) {}
847+
if (level < 3 && canAcess) {
845848
var hrefs = styleSheet.cssText.match(IMPORTS);
846849
// loop through imported style sheets
847850
for (var i = 0, imported; i < styleSheet.imports.length; i++) {
@@ -934,7 +937,14 @@ var StyleSheet = Base.extend({
934937
},
935938

936939
parse: function() {
937-
this.cssText = IE7.CSS.parser.parse(this.cssText);
940+
var cssText = IE7.CSS.parser.parse(this.cssText);
941+
942+
var declarations = "";
943+
this.cssText = cssText.replace(/@charset[^;]+;|@font\-face[^\}]+\}/g, function(match) {
944+
declarations += match + "\n";
945+
return "";
946+
});
947+
this.declarations = decode(declarations);
938948

939949
// Parse the style sheet
940950
var offset = IE7.CSS.rules.length;
@@ -963,7 +973,7 @@ var StyleSheet = Base.extend({
963973
},
964974

965975
toString: function() {
966-
return "@media " + this.media + "{" + this.cssText + "}";
976+
return this.declarations + "@media " + this.media + "{" + this.cssText + "}";
967977
}
968978
});
969979

@@ -1132,25 +1142,23 @@ var DynamicPseudoClass = Base.extend({
11321142
// dynamic pseudo-classes
11331143
// -----------------------------------------------------------------------
11341144

1135-
if (appVersion < 7) {
1136-
var Hover = new DynamicPseudoClass("hover", function(element) {
1137-
var instance = arguments;
1138-
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1139-
Hover.register(instance);
1140-
});
1141-
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1142-
Hover.unregister(instance);
1143-
});
1145+
var Hover = new DynamicPseudoClass("hover", function(element) {
1146+
var instance = arguments;
1147+
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1148+
Hover.register(instance);
11441149
});
1145-
1146-
// globally trap the mouseup event (thanks Martijn!)
1147-
addEventHandler(document, "onmouseup", function() {
1148-
var instances = Hover.instances;
1149-
for (var i in instances)
1150-
if (!instances[i][0].contains(event.srcElement))
1151-
Hover.unregister(instances[i]);
1150+
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1151+
Hover.unregister(instance);
11521152
});
1153-
}
1153+
});
1154+
1155+
// globally trap the mouseup event (thanks Martijn!)
1156+
addEventHandler(document, "onmouseup", function() {
1157+
var instances = Hover.instances;
1158+
for (var i in instances)
1159+
if (!instances[i][0].contains(event.srcElement))
1160+
Hover.unregister(instances[i]);
1161+
});
11541162

11551163
var ATTR = {
11561164
"=": "%1==='%2'", // "[@%1='%2']"
@@ -1181,8 +1189,8 @@ var FILTER = {
11811189

11821190
// PSEDUO
11831191
":first-child": "!" + PREVIOUS_SIBLING + "&&",
1184-
":link": "e.href&&(e.nodeName==='A'||e.nodeName==='AREA')&&",
1185-
":visited": "false&&" // not implemented (security)
1192+
":link": "e.currentStyle['ie7-link']=='link'&&",
1193+
":visited": "e.currentStyle['ie7-link']=='visited'&&"
11861194
};
11871195

11881196
// =========================================================================

lib/src/IE9.js

+46-31
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
Ingo Chao
1818
*/
1919

20-
// timestamp: Sun, 07 Mar 2010 18:13:50
20+
// timestamp: Fri, 30 Apr 2010 20:59:18
2121

2222
(function(window, document) {
2323

2424
var IE7 = window.IE7 = {
25-
version: "2.1(beta3)",
25+
version: "2.1(beta4)",
2626
toString: K("[IE7]")
2727
};
2828
IE7.compat = 9;
@@ -841,7 +841,10 @@ var StyleSheet = Base.extend({
841841
if (media === "all" || media === self.media) {
842842
// IE only allows importing style sheets three levels deep.
843843
// it will crash if you try to access a level below this
844-
if (level < 3 && styleSheet.cssText) {
844+
try {
845+
var canAcess = !!styleSheet.cssText;
846+
} catch (exe) {}
847+
if (level < 3 && canAcess) {
845848
var hrefs = styleSheet.cssText.match(IMPORTS);
846849
// loop through imported style sheets
847850
for (var i = 0, imported; i < styleSheet.imports.length; i++) {
@@ -934,7 +937,14 @@ var StyleSheet = Base.extend({
934937
},
935938

936939
parse: function() {
937-
this.cssText = IE7.CSS.parser.parse(this.cssText);
940+
var cssText = IE7.CSS.parser.parse(this.cssText);
941+
942+
var declarations = "";
943+
this.cssText = cssText.replace(/@charset[^;]+;|@font\-face[^\}]+\}/g, function(match) {
944+
declarations += match + "\n";
945+
return "";
946+
});
947+
this.declarations = decode(declarations);
938948

939949
// Parse the style sheet
940950
var offset = IE7.CSS.rules.length;
@@ -963,7 +973,7 @@ var StyleSheet = Base.extend({
963973
},
964974

965975
toString: function() {
966-
return "@media " + this.media + "{" + this.cssText + "}";
976+
return this.declarations + "@media " + this.media + "{" + this.cssText + "}";
967977
}
968978
});
969979

@@ -1132,25 +1142,23 @@ var DynamicPseudoClass = Base.extend({
11321142
// dynamic pseudo-classes
11331143
// -----------------------------------------------------------------------
11341144

1135-
if (appVersion < 7) {
1136-
var Hover = new DynamicPseudoClass("hover", function(element) {
1137-
var instance = arguments;
1138-
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1139-
Hover.register(instance);
1140-
});
1141-
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1142-
Hover.unregister(instance);
1143-
});
1145+
var Hover = new DynamicPseudoClass("hover", function(element) {
1146+
var instance = arguments;
1147+
IE7.CSS.addEventHandler(element, "onmouseenter", function() {
1148+
Hover.register(instance);
11441149
});
1145-
1146-
// globally trap the mouseup event (thanks Martijn!)
1147-
addEventHandler(document, "onmouseup", function() {
1148-
var instances = Hover.instances;
1149-
for (var i in instances)
1150-
if (!instances[i][0].contains(event.srcElement))
1151-
Hover.unregister(instances[i]);
1150+
IE7.CSS.addEventHandler(element, "onmouseleave", function() {
1151+
Hover.unregister(instance);
11521152
});
1153-
}
1153+
});
1154+
1155+
// globally trap the mouseup event (thanks Martijn!)
1156+
addEventHandler(document, "onmouseup", function() {
1157+
var instances = Hover.instances;
1158+
for (var i in instances)
1159+
if (!instances[i][0].contains(event.srcElement))
1160+
Hover.unregister(instances[i]);
1161+
});
11541162

11551163
var ATTR = {
11561164
"=": "%1==='%2'", // "[@%1='%2']"
@@ -1181,8 +1189,8 @@ var FILTER = {
11811189

11821190
// PSEDUO
11831191
":first-child": "!" + PREVIOUS_SIBLING + "&&",
1184-
":link": "e.href&&(e.nodeName==='A'||e.nodeName==='AREA')&&",
1185-
":visited": "false&&" // not implemented (security)
1192+
":link": "e.currentStyle['ie7-link']=='link'&&",
1193+
":visited": "e.currentStyle['ie7-link']=='visited'&&"
11861194
};
11871195

11881196
// =========================================================================
@@ -2504,6 +2512,17 @@ FILTER = extend(extend({
25042512
":target": "H&&" + ID_ATTRIBUTE + "===H&&"
25052513
});
25062514

2515+
var HTML5 = "article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(",");
2516+
for (var i = 0, tagName; tagName = HTML5[i]; i++) document.createElement(tagName);
2517+
2518+
HEADER += "datalist{display:none}\
2519+
details{padding-left:40px;display:block;margin:1em 0}\
2520+
meter,progress{vertical-align:-0.2em;width:5em;height:1em;display:inline-block}\
2521+
progress{width:10em;}\
2522+
article,aside,figcaption,footer,header,hgroup,summary,section,nav{display:block;margin:1em 0}\
2523+
figure{margin:1em 40px;display:block}\
2524+
mark{background:yellow}";
2525+
25072526
// =========================================================================
25082527
// ie9-layout.js
25092528
// =========================================================================
@@ -2512,13 +2531,9 @@ FILTER = extend(extend({
25122531
// ie9-graphics.js
25132532
// =========================================================================
25142533

2515-
if (appVersion === 8) {
2516-
IE7.CSS.addFix(/\bopacity\s*:/, "-ms-opacity:");
2517-
} else {
2518-
IE7.CSS.addFix(/\bopacity\s*:\s*([\d.]+)/, function(match, value) {
2519-
return "zoom:1;filter:Alpha(opacity=" + ((value * 100) || 1) + ")";
2520-
});
2521-
}
2534+
IE7.CSS.addFix(/\bopacity\s*:\s*([\d.]+)/, function(match, value) {
2535+
return "zoom:1;filter:Alpha(opacity=" + ((value * 100) || 1) + ")";
2536+
});
25222537

25232538
var MATCHER;
25242539

lib/src/ie7-squish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
--------------------------------------------------------------------- */
1010

11-
// @NOTE: ie7Layout.boxSizing is the same as the "Holly Hack"
11+
// NOTE: IE7.Layout.boxSizing is the same as the "Holly Hack"
1212

1313
if (IE7.loaded && IE7.appVersion < 7) {
1414

src/build.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
(function(window, document) {
3131

3232
var IE7 = window.IE7 = {
33-
version: "2.1(beta3)",
33+
version: "2.1(beta4)",
3434
toString: K("[IE7]")
3535
};
3636
<?php
@@ -311,6 +311,7 @@ function createTempElement(tagName) {
311311
include('ie8-graphics.js');
312312
if ($compat == 9) {
313313
include('ie9-css.js');
314+
include('ie9-html.js');
314315
include('ie9-layout.js');
315316
include('ie9-graphics.js');
316317
}

0 commit comments

Comments
 (0)