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

DOM Exception trigger with ButtonDirective afterViewInit #9497

Closed
LoganFievez opened this issue Nov 5, 2020 · 1 comment
Closed

DOM Exception trigger with ButtonDirective afterViewInit #9497

LoganFievez opened this issue Nov 5, 2020 · 1 comment
Assignees
Labels
LTS-FIXED-9.2.0 Fixed in PrimeNG LTS 9.2.0 LTS-FIXED-10.0.5 Fixed in PrimeNG LTS 10.0.5 Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@LoganFievez
Copy link

LoganFievez commented Nov 5, 2020

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)

<button pButton icon="my-icon "> <!-- the space at the end is intentional -->

Current behavior
An error is trigger when the lifecycle hook afterViewInit is trigger

Expected behavior
No error

Minimal reproduction of the problem with instructions

  • Create an icon only button with pButton directive where in the icon section a space char is left

What is the motivation / use case for changing the behavior?

  • Help people avoiding hours of debugging just to find a space char ;)

Please tell us about your environment:
Ubuntu 18.04

  • Angular version: 10.2.1
  • PrimeNG version: 10.0.3
  • Browser: all

  • Language: all

  • Node (for AoT issues): node --version = v14.8.0

Solution

  • In domhandler.ts in the static method addMultipleClasses before running element.classList.add(styles[i]); you should test if styles[i] is ok to be added to the classList
@cagataycivici cagataycivici self-assigned this Nov 17, 2020
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Nov 17, 2020
@cagataycivici cagataycivici added this to the 11.0.0-rc.1 milestone Nov 17, 2020
@LoganFievez
Copy link
Author

LoganFievez commented Nov 17, 2020

Is it not better to split using a regex like this : className.trim().split(/\s+/); because the className could be like this class="class01 class02" (with two spaces in it)

Thanks ;)

@yigitfindikli yigitfindikli added LTS-FIXED-10.0.5 Fixed in PrimeNG LTS 10.0.5 LTS-FIXED-9.2.0 Fixed in PrimeNG LTS 9.2.0 and removed LTS-PORTABLE labels Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-FIXED-9.2.0 Fixed in PrimeNG LTS 9.2.0 LTS-FIXED-10.0.5 Fixed in PrimeNG LTS 10.0.5 Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants