diff options
author | fqian@google.com <fqian@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 20:16:54 +0000 |
---|---|---|
committer | fqian@google.com <fqian@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 20:16:54 +0000 |
commit | 081a65a887ebaa5eaf079b2bc7822c4c2e0670fc (patch) | |
tree | 5a11cdec8087fa8c42c391d113e97116e7f634fe /webkit/port/bindings/v8 | |
parent | faf19bbf27a42842d4d2bc9a1e689dfcac3bd675 (diff) | |
download | chromium_src-081a65a887ebaa5eaf079b2bc7822c4c2e0670fc.zip chromium_src-081a65a887ebaa5eaf079b2bc7822c4c2e0670fc.tar.gz chromium_src-081a65a887ebaa5eaf079b2bc7822c4c2e0670fc.tar.bz2 |
Fix the issue http://code.google.com/p/v8/issues/detail?id=43
Image & Option functions should have precendence than document elements.
Review URL: http://codereview.chromium.org/1968
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings/v8')
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index 205b6c3..a16fd8d 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -1282,20 +1282,6 @@ NAMED_PROPERTY_GETTER(DOMWindow) { if (!result.IsEmpty()) return result; - // Search named items in the document. - Document* doc = frame->document(); - if (doc) { - RefPtr<HTMLCollection> items = doc->windowNamedItems(prop_name); - if (items->length() >= 1) { - if (items->length() == 1) { - return V8Proxy::ToV8Object(V8ClassIndex::NODE, items->firstItem()); - } else { - return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, - static_cast<Peerable*>(items.get())); - } - } - } - // Lazy initialization map keeps global properties that can be lazily // initialized. The value is the code to instantiate the property. // It must return the value of property after initialization. @@ -1349,11 +1335,23 @@ NAMED_PROPERTY_GETTER(DOMWindow) { ASSERT(proxy); v8::Local<v8::Value> result = proxy->Evaluate(prop_name, 0, code, 0); - if (result.IsEmpty()) return result; - return result; } + // Search named items in the document. + Document* doc = frame->document(); + if (doc) { + RefPtr<HTMLCollection> items = doc->windowNamedItems(prop_name); + if (items->length() >= 1) { + if (items->length() == 1) { + return V8Proxy::ToV8Object(V8ClassIndex::NODE, items->firstItem()); + } else { + return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, + static_cast<Peerable*>(items.get())); + } + } + } + return v8::Handle<v8::Value>(); } @@ -1415,6 +1413,8 @@ NAMED_PROPERTY_GETTER(HTMLDocument) { if (!imp->hasNamedItem(key) && !imp->hasDocExtraNamedItem(key)) { return v8::Handle<v8::Value>(); } + + RefPtr<HTMLCollection> items = imp->documentNamedItems(key); if (items->length() == 0) return v8::Handle<v8::Value>(); if (items->length() == 1) { |