| 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 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 } | 2550 } |
| 2551 | 2551 |
| 2552 bool Element::matches(const String& selectors, ExceptionState& exceptionState) | 2552 bool Element::matches(const String& selectors, ExceptionState& exceptionState) |
| 2553 { | 2553 { |
| 2554 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr
ing(selectors), document(), exceptionState); | 2554 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr
ing(selectors), document(), exceptionState); |
| 2555 if (!selectorQuery) | 2555 if (!selectorQuery) |
| 2556 return false; | 2556 return false; |
| 2557 return selectorQuery->matches(*this); | 2557 return selectorQuery->matches(*this); |
| 2558 } | 2558 } |
| 2559 | 2559 |
| 2560 Element* Element::closest(const String& selectors, ExceptionState& exceptionStat
e) | |
| 2561 { | |
| 2562 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr
ing(selectors), document(), exceptionState); | |
| 2563 if (selectorQuery) { | |
| 2564 for (Element* currentElement = this; currentElement; currentElement = cu
rrentElement->parentElement()) { | |
| 2565 if (selectorQuery->matches(*currentElement)) | |
| 2566 return currentElement; | |
| 2567 } | |
| 2568 } | |
| 2569 | |
| 2570 return nullptr; | |
| 2571 } | |
| 2572 | |
| 2573 DOMTokenList& Element::classList() | 2560 DOMTokenList& Element::classList() |
| 2574 { | 2561 { |
| 2575 ElementRareData& rareData = ensureElementRareData(); | 2562 ElementRareData& rareData = ensureElementRareData(); |
| 2576 if (!rareData.classList()) | 2563 if (!rareData.classList()) |
| 2577 rareData.setClassList(ClassList::create(this)); | 2564 rareData.setClassList(ClassList::create(this)); |
| 2578 return *rareData.classList(); | 2565 return *rareData.classList(); |
| 2579 } | 2566 } |
| 2580 | 2567 |
| 2581 DOMStringMap& Element::dataset() | 2568 DOMStringMap& Element::dataset() |
| 2582 { | 2569 { |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 return wrapper; | 3267 return wrapper; |
| 3281 | 3268 |
| 3282 CustomElementBinding* binding = perContextData->customElementBinding(customE
lementDefinition()); | 3269 CustomElementBinding* binding = perContextData->customElementBinding(customE
lementDefinition()); |
| 3283 | 3270 |
| 3284 wrapper->SetPrototype(binding->prototype()); | 3271 wrapper->SetPrototype(binding->prototype()); |
| 3285 | 3272 |
| 3286 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType
, wrapper, isolate); | 3273 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType
, wrapper, isolate); |
| 3287 } | 3274 } |
| 3288 | 3275 |
| 3289 } // namespace blink | 3276 } // namespace blink |
| OLD | NEW |