From 9c8d9d89d6cfb0e51b92e45df03f04b18f12f5a5 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Mon, 5 May 2008 09:37:43 +0200 Subject: [PATCH] Replace all instances of foo.__proto__ by foo['__proto__'] for Caja-compliance. --- CHANGELOG | 2 ++ src/dom.js | 6 +++--- src/event.js | 2 +- src/prototype.js | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 03df885..926616f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Replace all instances of foo.__proto__ by foo['__proto__'] for Caja-compliance. (Tobie Langel) + * Speed up Function#argumentNames. Avoid Enum dependency. (samleb, Tobie Langel) * Fix Event#element accessing inexistent tagName property (e.g. when element is a document). (kangax) diff --git a/src/dom.js b/src/dom.js index e9b878c..45e8533 100644 --- a/src/dom.js +++ b/src/dom.js @@ -1035,9 +1035,9 @@ Element.Methods.ByTag = { }; Object.extend(Element, Element.Methods); if (!Prototype.BrowserFeatures.ElementExtensions && - document.createElement('div').__proto__) { + document.createElement('div')['__proto__']) { window.HTMLElement = { }; - window.HTMLElement.prototype = document.createElement('div').__proto__; + window.HTMLElement.prototype = document.createElement('div')['__proto__']; Prototype.BrowserFeatures.ElementExtensions = true; } @@ -1148,7 +1148,7 @@ Element.addMethods = function(methods) { if (window[klass]) return window[klass]; window[klass] = { }; - window[klass].prototype = document.createElement(tagName).__proto__; + window[klass].prototype = document.createElement(tagName)['__proto__']; return window[klass]; } diff --git a/src/event.js b/src/event.js index 3691fde..4e87a2b 100644 --- a/src/event.js +++ b/src/event.js @@ -138,7 +138,7 @@ Event.extend = (function() { }; } else { - Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__; + Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__']; Object.extend(Event.prototype, methods); return Prototype.K; } diff --git a/src/prototype.js b/src/prototype.js index d879ff6..d0a874c 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -16,9 +16,9 @@ var Prototype = { SelectorsAPI: !!document.querySelector, ElementExtensions: !!window.HTMLElement, SpecificElementExtensions: - document.createElement('div').__proto__ && - document.createElement('div').__proto__ !== - document.createElement('form').__proto__ + document.createElement('div')['__proto__'] && + document.createElement('div')['__proto__'] !== + document.createElement('form')['__proto__'] }, ScriptFragment: ']*>([\\S\\s]*?)<\/script>',