diff --git a/src/matcher.ts b/src/matcher.ts index 4af62f5..556da13 100644 --- a/src/matcher.ts +++ b/src/matcher.ts @@ -1,4 +1,4 @@ -import { Adapter/*, Predicate*/ } from 'css-select/lib/types'; +import { Adapter /*, Predicate*/ } from 'css-select/lib/types'; import HTMLElement from './nodes/html'; import Node from './nodes/node'; import NodeType from './nodes/type'; @@ -70,7 +70,7 @@ function existsOne(test: Predicate, elems: Node[]): boolean { function getSiblings(node: Node) { const parent = getParent(node); - return parent && getChildren(parent); + return parent ? getChildren(parent) : []; } function hasAttrib(elem: HTMLElement, name: string) { diff --git a/test/assets/html/melon.html b/test/assets/html/melon.html new file mode 100644 index 0000000..6ddb173 --- /dev/null +++ b/test/assets/html/melon.html @@ -0,0 +1,594 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +melonJS is an open source HTML5 game engine that empowers developers and designers to focus on content.
++ The framework provides a collection of composable entities and support for a number of third-party tools. Giving you a powerful combination that can be used wholesale or piecemeal. +
++ Download + Read The Docs » +
+Use the following keys to start playing a simple game built with melonJS. Try it with a gamepad!
+Key | Action |
---|---|
W Spacebar | Jump |
A | Walk Left |
S | Drop Down |
D | Walk Right |
F | Full-Screen Mode |
Esc | Exit Game |
See you in a bit!
+melonJS is a lightweight yet powerful HTML5 framework designed from the ground up to provide a true plugin-free 'write-once, run-everywhere' gaming platform. melonJS is an open-source project and supported by a community of enthusiasts. See our Gallery for a few examples of games powered by melonJS.
+++Built with future technology.
+ ++
+- WebGL +
- WebAudio +
- ES6 Collections +
++Released under the permissive MIT License.
+No cost.
+Royalty free.
+Forever.
+
++Your scene graph is a hierarchy of containers.
+Updates and drawing operations are dispatched separately.
+Draws are opt-in; add compute-only entities for AI, special effects, etc.
+
melonJS integrates the popular Tiled map format, allowing designers easily create levels using the Tiled map editor, and to focus on the game features itself.
+ +Master Spy by Turbogun | +Radmars Team - Ludum Dare & GameJam | +
---|---|
+ | + |
melonJS works with any full ES5 compatible browsers
+Browser | Version | Status |
---|---|---|
+ Chrome + | +55+ | ++ |
Safari | +10+ | ++ |
Firefox | +50+ | ++ |
Opera | +42+ | ++ |
IE | +11+ | ++ |
Chrome for Mobile | +55+ | ++ |
iOS Safari | +9.3+ | ++ |