OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "HTMLScriptElement.h" | 24 #include "HTMLScriptElement.h" |
25 | 25 |
26 #include "Attribute.h" | 26 #include "Attribute.h" |
27 #include "Document.h" | 27 #include "Document.h" |
28 #include "Event.h" | 28 #include "Event.h" |
29 #include "EventNames.h" | 29 #include "EventNames.h" |
30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
31 #include "ScriptEventListener.h" | 31 #include "ScriptEventListener.h" |
| 32 #include "Settings.h" |
32 #include "Text.h" | 33 #include "Text.h" |
33 | 34 |
34 namespace WebCore { | 35 namespace WebCore { |
35 | 36 |
36 using namespace HTMLNames; | 37 using namespace HTMLNames; |
37 | 38 |
38 inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Docume
nt* document, bool wasInsertedByParser, bool alreadyStarted) | 39 inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Docume
nt* document, bool wasInsertedByParser, bool alreadyStarted) |
39 : HTMLElement(tagName, document) | 40 : HTMLElement(tagName, document) |
40 , ScriptElement(this, wasInsertedByParser, alreadyStarted) | 41 , ScriptElement(this, wasInsertedByParser, alreadyStarted) |
41 { | 42 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 else if (attrName == onloadAttr) | 75 else if (attrName == onloadAttr) |
75 setAttributeEventListener(eventNames().loadEvent, createAttributeEventLi
stener(this, attr)); | 76 setAttributeEventListener(eventNames().loadEvent, createAttributeEventLi
stener(this, attr)); |
76 else if (attrName == onbeforeloadAttr) | 77 else if (attrName == onbeforeloadAttr) |
77 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeE
ventListener(this, attr)); | 78 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeE
ventListener(this, attr)); |
78 else if (attrName == onbeforeprocessAttr) | 79 else if (attrName == onbeforeprocessAttr) |
79 setAttributeEventListener(eventNames().beforeprocessEvent, createAttribu
teEventListener(this, attr)); | 80 setAttributeEventListener(eventNames().beforeprocessEvent, createAttribu
teEventListener(this, attr)); |
80 else | 81 else |
81 HTMLElement::parseMappedAttribute(attr); | 82 HTMLElement::parseMappedAttribute(attr); |
82 } | 83 } |
83 | 84 |
| 85 static bool needsOldRequirejsQuirk(HTMLScriptElement* element) |
| 86 { |
| 87 if (element->fastGetAttribute(typeAttr) != "script/cache") |
| 88 return false; |
| 89 |
| 90 Document* document = element->document(); |
| 91 |
| 92 const KURL& url = document->url(); |
| 93 if (!equalIgnoringCase(url.host(), "www.zipcar.com")) |
| 94 return false; |
| 95 |
| 96 Settings* settings = document->settings(); |
| 97 if (!settings) |
| 98 return false; |
| 99 if (!settings->needsSiteSpecificQuirks()) |
| 100 return false; |
| 101 |
| 102 return true; |
| 103 } |
| 104 |
84 void HTMLScriptElement::insertedIntoDocument() | 105 void HTMLScriptElement::insertedIntoDocument() |
85 { | 106 { |
| 107 if (needsOldRequirejsQuirk(this)) { |
| 108 if (!asyncAttributeValue()) |
| 109 handleAsyncAttribute(); // Clear forceAsync, so this script loads in
parallel, but executes in order. |
| 110 setAttribute(typeAttr, "text/javascript"); |
| 111 } |
86 HTMLElement::insertedIntoDocument(); | 112 HTMLElement::insertedIntoDocument(); |
87 ScriptElement::insertedIntoDocument(); | 113 ScriptElement::insertedIntoDocument(); |
88 } | 114 } |
89 | 115 |
90 void HTMLScriptElement::removedFromDocument() | 116 void HTMLScriptElement::removedFromDocument() |
91 { | 117 { |
92 HTMLElement::removedFromDocument(); | 118 HTMLElement::removedFromDocument(); |
93 ScriptElement::removedFromDocument(); | 119 ScriptElement::removedFromDocument(); |
94 } | 120 } |
95 | 121 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 { | 215 { |
190 dispatchEvent(Event::create(eventNames().errorEvent, true, false)); | 216 dispatchEvent(Event::create(eventNames().errorEvent, true, false)); |
191 } | 217 } |
192 | 218 |
193 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren(
) const | 219 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren(
) const |
194 { | 220 { |
195 return adoptRef(new HTMLScriptElement(tagQName(), document(), false, already
Started())); | 221 return adoptRef(new HTMLScriptElement(tagQName(), document(), false, already
Started())); |
196 } | 222 } |
197 | 223 |
198 } | 224 } |
OLD | NEW |