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
Add support for rendering into non-body DOM nodes #249
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
global.Get("document") | ||
global.Get("document").Call("querySelector", "body") | ||
global.Get("document") | ||
global.Get("document").Call("createElement", "div") | ||
global.Get("document").Call("createElement", "div").Get("classList") | ||
global.Get("document").Call("createElement", "div").Get("dataset") | ||
global.Get("document").Call("createElement", "div").Get("style") | ||
global.Get("document").Call("createElement", "div").Get("style") | ||
global.Get("document").Call("querySelector", "body").Get("nodeName") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
global.Get("document") | ||
global.Get("document").Call("querySelector", "body") | ||
global.Get("document") | ||
global.Get("document").Call("createElement", "noscript") | ||
global.Get("document").Call("createElement", "noscript").Get("classList") | ||
global.Get("document").Call("createElement", "noscript").Get("dataset") | ||
global.Get("document").Call("createElement", "noscript").Get("style") | ||
global.Get("document").Call("createElement", "noscript").Get("style") | ||
global.Get("document").Call("querySelector", "body").Get("nodeName") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
global.Get("document") | ||
global.Get("document").Call("querySelector", "body") | ||
global.Get("document") | ||
global.Get("document").Call("createTextNode", "Hello world!") | ||
global.Get("document").Call("createTextNode", "Hello world!").Get("classList") | ||
global.Get("document").Call("createTextNode", "Hello world!").Get("dataset") | ||
global.Get("document").Call("createTextNode", "Hello world!").Get("style") | ||
global.Get("document").Call("createTextNode", "Hello world!").Get("style") | ||
global.Get("document").Call("querySelector", "body").Get("nodeName") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
global.Get("document") | ||
global.Get("document").Call("querySelector", "body") | ||
global.Get("document") | ||
global.Get("document").Call("createElement", "body") | ||
global.Get("document").Call("createElement", "body").Get("classList") | ||
global.Get("document").Call("createElement", "body").Get("dataset") | ||
global.Get("document").Call("createElement", "body").Get("style") | ||
global.Get("document").Call("querySelector", "body").Get("nodeName") | ||
global.Get("document") | ||
global.Get("document").Get("readyState") | ||
global.Get("document").Set("body", jsObject(global.Get("document").Call("createElement", "body"))) | ||
global.Get("document").Call("querySelector", "body").Get("parentNode") | ||
global.Get("document").Call("querySelector", "body").Get("parentNode").Call("replaceChild", jsObject(global.Get("document").Call("createElement", "body")), jsObject(global.Get("document").Call("querySelector", "body"))) | ||
global.Call("requestAnimationFrame", func) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
global.Get("document") | ||
global.Get("document").Call("querySelector", "body") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe I'm running into an issue with
nodeName
case sensitivity here (see https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName and https://johnresig.com/blog/nodename-case-sensitivity/).My program is doing:
And getting:
I'm using HTML, Chrome 78.0.3904.108 on macOS.
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.
I tried the following quick change to see if it would be sufficient to solve the problem:
It was; after that, Go Package Store was rendering the frontend without issues.
I'm not sure if that's the optimal long term fix, or if there's a better way. You may not want to import a new
strings
package just for one function.I tried using JavaScript's
toLowerCase
method, but for some reason that didn't work in the context of Vecty:Even though it seems to work fine elsewhere, e.g., see https://gopherjs.github.io/playground/#/UxD9vDjbf0.
Hope this is helpful.
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.
About the "syscall/js: call of Value.Call on string" error, I found it happens when using
syscall/js
package with GopherJS but not when usinggithub.com/gopherjs/gopherjs/js
package. So it's not Vecty-specific beyond Vecty usingsyscall/js
.It happens when using
syscall/js
with both GopherJS and Go/WebAssembly, so I filed golang/go#35917 to learn more about that.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.
Thank you for investigating this! I've sent #251 to fix the issue on the Vecty side