Skip to content
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

Position start broken if body tag contains attributes #17

Open
daylamtayari opened this issue Apr 24, 2022 · 3 comments
Open

Position start broken if body tag contains attributes #17

daylamtayari opened this issue Apr 24, 2022 · 3 comments

Comments

@daylamtayari
Copy link

The start position option does not work if the body contains any attributes.

This results in the desired injected string to not be injected into the HTML file at all.

@daylamtayari
Copy link
Author

I have the full intention of submitting a PR fixing this in the very near future.

@daylamtayari
Copy link
Author

While I intended to submit a PR, the package cannot build following dev instructions, and after trying to fix multiple errors to get the package to build, etc. it wouldn't properly function.
I am not in a place to fully debug and fix this package from scratch so will simply post what needs to be changed.

@daylamtayari
Copy link
Author

In the else clause in lines 44-46, a clause needs to be added to check if the data.html has changed and if not, change the second parameter to be <body with the whitespace allowing for the possibility of attributes.

Example:

else {
  let init = data
  data.html = insertStringAfter(data.html, "<body>", this.options.content)
  if(data.html == init.html){
    data.html = insertStringAfter(data.html, "<body ", this.options.content)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant