Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Side by Side Diff: Source/core/dom/Element.cpp

Issue 701723007: Adding Element.closest() API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 } 2525 }
2526 2526
2527 bool Element::matches(const String& selectors, ExceptionState& exceptionState) 2527 bool Element::matches(const String& selectors, ExceptionState& exceptionState)
2528 { 2528 {
2529 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr ing(selectors), document(), exceptionState); 2529 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr ing(selectors), document(), exceptionState);
2530 if (!selectorQuery) 2530 if (!selectorQuery)
2531 return false; 2531 return false;
2532 return selectorQuery->matches(*this); 2532 return selectorQuery->matches(*this);
2533 } 2533 }
2534 2534
2535 Element* Element::closest(const String& selectors, ExceptionState& exceptionStat e)
2536 {
2537 SelectorQuery* selectorQuery = document().selectorQueryCache().add(AtomicStr ing(selectors), document(), exceptionState);
2538 if (!selectorQuery)
2539 return nullptr;
2540 return selectorQuery->closest(*this);
2541 }
2542
2535 DOMTokenList& Element::classList() 2543 DOMTokenList& Element::classList()
2536 { 2544 {
2537 ElementRareData& rareData = ensureElementRareData(); 2545 ElementRareData& rareData = ensureElementRareData();
2538 if (!rareData.classList()) 2546 if (!rareData.classList())
2539 rareData.setClassList(ClassList::create(this)); 2547 rareData.setClassList(ClassList::create(this));
2540 return *rareData.classList(); 2548 return *rareData.classList();
2541 } 2549 }
2542 2550
2543 DOMStringMap& Element::dataset() 2551 DOMStringMap& Element::dataset()
2544 { 2552 {
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 return wrapper; 3250 return wrapper;
3243 3251
3244 CustomElementBinding* binding = perContextData->customElementBinding(customE lementDefinition()); 3252 CustomElementBinding* binding = perContextData->customElementBinding(customE lementDefinition());
3245 3253
3246 wrapper->SetPrototype(binding->prototype()); 3254 wrapper->SetPrototype(binding->prototype());
3247 3255
3248 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper); 3256 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper);
3249 } 3257 }
3250 3258
3251 } // namespace blink 3259 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698