Created
February 20, 2015 16:42
-
-
Save joey-g/f35428ea219d4768dc4a to your computer and use it in GitHub Desktop.
Automation Training Week 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| In the example below, attempting to access the individual input element in | |
| the second div is possible using an ancestor/descendant selector. If we | |
| only selected the input with the class "test_class" with: | |
| document.querySelector('input.test_class'); | |
| We wouldn't be guaranteed to receive a unique element, as this selector | |
| would match both input elements. | |
| If we instead changed the selector to use the second div element as the | |
| ancestor element, and changed our selector to read: | |
| document.querySelector('div.test_class_2 input.test_class'); | |
| We would be guaranteed to receive the second div's input element as the | |
| only match for our query. | |
| --> | |
| <div class = "test_class_1"> | |
| <input class = "test_class"/> | |
| </div> | |
| <div class = "test_class_2"> | |
| <input class = "test_class"/> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment