|
| 1 | +import {query, querySelectorAll, closest, getAttribute, namedItem} from "../index"; |
| 2 | + |
| 3 | +const bodyElement1 = query(document, 'body'); |
| 4 | +const bodyElement2 = query(document, 'body', HTMLBodyElement); |
| 5 | +const bodyElement3 = query<HTMLBodyElement>(document, 'body'); |
| 6 | +const bodyElement4 = query<HTMLBodyElement>(document, 'body', HTMLBodyElement); |
| 7 | + |
| 8 | +const formElements1 = querySelectorAll(bodyElement1, '.js-comment-form'); |
| 9 | +const formElements2 = querySelectorAll(bodyElement2, '.js-comment-form', HTMLFormElement); |
| 10 | +const formElements3 = querySelectorAll<HTMLFormElement>(bodyElement3, '.js-comment-form'); |
| 11 | +const formElements4 = querySelectorAll<HTMLFormElement>(bodyElement4, '.js-comment-form', HTMLFormElement); |
| 12 | + |
| 13 | +const htmlElement1 = closest(bodyElement1, 'html'); |
| 14 | +const htmlElement2 = closest(bodyElement2, 'html', HTMLHtmlElement); |
| 15 | +const htmlElement3 = closest<HTMLHtmlElement>(bodyElement3, 'html'); |
| 16 | +const htmlElement4 = closest<HTMLHtmlElement>(bodyElement4, 'html', HTMLHtmlElement); |
| 17 | + |
| 18 | +const bodyThing = getAttribute(bodyElement1, 'data-things'); |
| 19 | + |
| 20 | +const commentForm = formElements3[0]; |
| 21 | + |
| 22 | +const usernameField = namedItem(commentForm, 'username'); |
| 23 | +const nameField = namedItem(commentForm, 'name', HTMLInputElement); |
| 24 | +const emailField = namedItem<HTMLFormElement>(commentForm, 'email', HTMLInputElement); |
| 25 | +const mailinglistsField = namedItem<HTMLFormElement>(commentForm, 'mailinglists', RadioNodeList); |
| 26 | +const locationField = namedItem<HTMLFormElement>(commentForm, 'location', HTMLSelectElement); |
0 commit comments