Test6 = (function() { var NO = 0, YES = 1, OLD = 2, BUGGY = 4, PREFIX = 8, BLOCKED = 16; var release = 6; var blacklists = {}; function results (parent) { this.initialize(parent); } results.prototype = { initialize: function(parent) { this.parent = parent; this.items = []; this.points = 0; this.max = 0; this.backgroundTasks = 0; this.update(); }, startBackground: function(id) { this.parent.startBackground(id); }, stopBackground: function(id) { this.parent.stopBackground(id); }, getSection: function(data) { var i = new section(this, data); this.items.push(i); return i; }, update: function() { var points = 0; var max = 0; for (var i = 0; i < this.items.length; i++) { points += this.items[i].getPoints(); max += this.items[i].getMaximum(); } this.points = points; this.max = max; }, retrieve: function() { var data = { points: this.points, items: {} }; for (var i = 0; i < this.items.length; i++) { data.items[this.items[i].data.id] = this.items[i].retrieve(); } return data; } }; function section (parent, data) { this.initialize(parent, data); } section.prototype = { initialize: function(parent, data) { this.items = []; this.points = 0; this.max = 0; this.parent = parent; this.data = data; this.path = data.id; }, startBackground: function(id) { this.parent.startBackground(id); }, stopBackground: function(id) { this.parent.stopBackground(id); }, setItem: function(result) { var i = new item(this, result); this.items.push(i); this.update(); return i; }, getGroup: function(data) { var i = new group(this, data); this.items.push(i); return i; }, update: function() { var points = 0; var max = 0; for (var i = 0; i < this.items.length; i++) { points += this.items[i].getPoints(); max += this.items[i].getMaximum(); } this.points = points; this.max = max; this.parent.update(); }, getPoints: function() { return this.points; }, getMaximum: function() { return this.max; }, retrieve: function() { var data = { points: this.points, items: {} }; for (var i = 0; i < this.items.length; i++) { data.items[this.items[i].data.id] = this.items[i].retrieve(); } return data; } }; function group (parent, data) { this.initialize(parent, data); } group.prototype = { initialize: function(parent, data) { this.items = []; this.points = 0; this.max = 0; this.data = data; this.parent = parent; this.path = parent.path + '.' + data.id; }, update: function() { var points = 0; var max = 0; var count = 0; var hasRequired = false; var passedAll = true; var passedAllRequiredFields = true; var passedPartially = false; for (var i = 0; i < this.items.length; i++) { points += this.items[i].getPoints(); max += this.items[i].getMaximum(); count += this.items[i].getPassed() > 0 ? 1 : 0; if (this.items[i].getRequired()) { hasRequired = true; passedAllRequiredFields &= this.items[i].getPassed() > 0; } passedAll &= this.items[i].getPassed() > 0; passedPartially |= this.items[i].getPartiallyPassed(); } if (!passedAllRequiredFields) { points = 0; } if (this.data.value && this.items.length) { if (hasRequired ? passedAllRequiredFields : passedAll) { points += this.data.value; } max += this.data.value; } this.points = points; this.max = max; this.parent.update(); }, startBackground: function(id) { this.parent.startBackground(id); }, stopBackground: function(id) { this.parent.stopBackground(id); }, setItem: function(result) { var i = new item(this, result); this.items.push(i); this.update(); return i; }, getPoints: function() { return this.points; }, getMaximum: function() { return this.max; }, retrieve: function() { var data = { points: this.points, items: {} }; for (var i = 0; i < this.items.length; i++) { data.items[this.items[i].data.id] = this.items[i].retrieve(); } return data; } }; function item (parent, data) { this.initialize(parent, data); } item.prototype = { initialize: function(parent, data) { this.parent = parent; this.path = parent.path + '.' + data.id; this.data = data; if (typeof this.data.value == 'undefined') this.data.value = 0; if (typeof this.data.award == 'undefined') this.data.award = this.data.value; if (typeof this.data.passed == 'undefined') this.data.padded = false; if (this.data.passed && this.isOnBlacklist()) this.data.passed = BLOCKED; }, update: function(data) { for (var key in data) { this.data[key] = data[key]; } if (typeof this.data.value == 'undefined') this.data.value = 0; if (typeof this.data.award == 'undefined') this.data.award = this.data.value; if (typeof this.data.passed == 'undefined') this.data.passed = false; if (this.data.passed && this.isOnBlacklist()) this.data.passed = BLOCKED; this.parent.update(); }, isOnBlacklist: function() { var part = ''; var parts = this.path.split('.'); for (var i = 0; i < parts.length; i++) { part += (i == 0 ? '' : '.') + parts[i]; if (typeof blacklists[part] != 'undefined') { if (blacklists[part]) { return true; } } } return false; }, startBackground: function() { this.parent.startBackground(this.data.id); }, stopBackground: function() { this.parent.stopBackground(this.data.id); }, getPoints: function() { return this.data.passed & YES ? this.data.award : 0; }, getMaximum: function() { return this.data.value; }, getPassed: function() { return this.data.passed; }, getPartiallyPassed: function() { if (this.data.custom && this.data.custom == 'partial') { return true; } return this.getPassed(); }, getRequired: function() { return !!this.data.required; }, retrieve: function() { var data = { points: this.getPoints() }; return data; } }; var isEventSupported = (function(){ var TAGNAMES = { 'select':'input','change':'input','input':'input', 'submit':'form','reset':'form','forminput':'form','formchange':'form', 'error':'img','load':'img','abort':'img' } function isEventSupported(eventName, element) { element = element || document.createElement(TAGNAMES[eventName] || 'div'); eventName = 'on' + eventName; var isSupported = (eventName in element); if (!isSupported) { if (!element.setAttribute) { element = document.createElement('div'); } if (element.setAttribute && element.removeAttribute) { element.setAttribute(eventName, ''); isSupported = typeof element[eventName] == 'function'; if (typeof element[eventName] != 'undefined') { element[eventName] = void 0; } element.removeAttribute(eventName); } } element = null; return isSupported; } return isEventSupported; })(); var getRenderedStyle = (function(){ function getRenderedStyle(elem, name) { if (document.defaultView && document.defaultView.getComputedStyle) { s = document.defaultView.getComputedStyle(elem, ""); r = []; if (s.length) { for (var i = 0; i < s.length; i++) { try { v = s.getPropertyValue(s[i]); if (v != '') { r.push(s[i] + ': ' + v); } } catch(e) { }; } } else { for (var i in s) { try { v = s.getPropertyValue(i); if (v != '') { r.push(i + ': ' + v); } } catch(e) { }; } } return r.join('; ') + ';'; } else { return null; } } return getRenderedStyle; })(); function testParsing (results) { this.initialize(results); } testParsing.prototype = { initialize: function(results) { this.section = results.getSection({ id: 'parsing' }); this.section.setItem({ id: 'doctype', passed: document.compatMode == 'CSS1Compat', value: 0 }); var result = true; var e = document.createElement('div'); try { e.innerHTML = "