-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeWalker #37
base: master
Are you sure you want to change the base?
TreeWalker #37
Conversation
Thanks for the PR. A few things: The codebase style needs to be honored, so
I really need to setup There are also parts that touch unrelated parts of the codebase; please submit a separate PR for those |
I did you the honor.
Any idea how to outsource part of the commits to a separate branch? Also, how did you run the wpt tests? I had to comment out the argument check since deno doesnt allow arguments when testing. |
Alright, thanks. Everything mostly looks fine, but I'll check it in more detail later today or tomorrow.
You can create a new branch with git checkout -b new-branch-name run git reset --hard $COMMIT_HASH_FROM_REFLOG then the new branch will have the contents of the commit you reverted.
It's in the "Running tests" section of the readme:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was pretty busy. I noticed a few more things that need to be addressed before I can merge this
createComment(data?: string): Comment { | ||
return new Comment(data); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved?
@@ -102,7 +102,7 @@ export class Node extends EventTarget { | |||
this._setOwnerDocument(newParent.#ownerDocument); | |||
|
|||
// Add parent chain to ancestors | |||
let parent: Node | null = newParent; | |||
const parent: Node | null = newParent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this whole file, it is unrelated to the PR. If you want to submit this, please do it as a separate PR.
let unitDir = join(dirname(new URL(import.meta.url).pathname), "units"); | ||
if (Deno.build.os === "windows") { | ||
unitDir = unitDir.slice(1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
@@ -9,7 +9,7 @@ export type Backend = "wasm" | "native"; | |||
export async function run(path: string, root: string, backend: Backend) { | |||
const html = await Deno.readTextFile(path); | |||
const doc = parser.parseFromString(html, "text/html")!; | |||
let scripts = Array.from(doc.querySelectorAll("script")).map(scriptNode => { | |||
const scripts = Array.from(doc.querySelectorAll("script")).map(scriptNode => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this file
@@ -39,7 +39,7 @@ export function test(backend: Backend) { | |||
const limit = Infinity; | |||
let count = 0; | |||
|
|||
for (const testDir of [wptNodeTests]) { | |||
for (const testDir of [wptTraversalTests, wptNodeTests]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but WPT tests don't really work atm. We'll need to write some separate basic tests for TreeWalker in test/units
|
||
export interface Filter { | ||
acceptNode(node: Node): number; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to treewalker.ts
this.activeFlag = false; | ||
return result; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to treewalker.ts
@@ -289,7 +295,7 @@ export class Document extends Node { | |||
|
|||
export class HTMLDocument extends Document { | |||
constructor() { | |||
let lock = getLock(); | |||
const lock = getLock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this
Btw, to revert a full file you can use git checkout 813ce27 ./path/to/file.ts |
@b-fuze Any chance you could apply your suggestions to this branch yourself and get this merged? If not, if the staleness of these changes are an issue, I can fork this branch and open a fresh PR. |
@chances unfortunately, no. The contributor themselves has to give me access to modify the PR. I'll probably close this and implement it myself at some point. |
@b-fuze Access granted |
TreeWalker implementation for native,
The wpt/dom/traversal/TreeWalker unittest seems to be broken, it passes all other test.
I hope this helps.