Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix 2443 - IE9 throws error when setting input type to "email" #2471

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+36 −7
Split
View
@@ -593,15 +593,28 @@ el = null;
/* </webkit> */
/*<IE>*/
-var input = document.createElement('input');
+var input = document.createElement('input'), volatileInputValue, html5InputSupport;
+
+// #2178
input.value = 't';
input.type = 'submit';
-if (input.value != 't') propertySetters.type = function(node, type){
- var value = node.value;
- node.type = type;
- node.value = value;
-};
+volatileInputValue = input.value != 't';
+
+// #2443 - IE throws "Invalid Argument" when trying to use html5 input types
+try {
+ input.type = 'email';
+ html5InputSupport = input.type == 'email';
+} catch(e){}
+
input = null;
+
+if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
+ try {
+ var value = node.value;
+ node.type = type;
+ node.value = value;
+ } catch (e){}
+};
/*</IE>*/
/* getProperty, setProperty */
@@ -0,0 +1,9 @@
+
+describe('creating new Elements', function(){
+
+ it('should create an element with type="email"', function(){
+ var el = new Element('input', {type: 'email'});
+ expect(el.get('type')).toMatch(/email|text/);
+ });
+
+});
View
@@ -34,7 +34,7 @@ Configuration.presets = {
source: ['1.4nocompat']
},
'core-1.5': {
- sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-base', 'core-1.4-client', 'core-1.5-base'],
+ sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-base', 'core-1.4-client', 'core-1.5-base', 'core-1.5-client'],
source: ['core-1.4-base', 'core-1.4-client']
},
'core-2.0': {
@@ -129,6 +129,13 @@ Configuration.sets = {
]
},
+ 'core-1.5-client': {
+ path: '1.5client/',
+ files: [
+ 'Element/Element'
+ ]
+ },
+
'core-2.0-base': {
path: '2.0base/',
files: [