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

Is the index missing in setName from p5.XML? #7019

Closed
1 of 17 tasks
IronBlood opened this issue May 6, 2024 · 1 comment · Fixed by #7027
Closed
1 of 17 tasks

Is the index missing in setName from p5.XML? #7019

IronBlood opened this issue May 6, 2024 · 1 comment · Fixed by #7027

Comments

@IronBlood
Copy link
Contributor

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

No response

Web browser and version

No response

Operating system

No response

Steps to reproduce this

The source code is shown below:

  setName(name) {
    const content = this.DOM.innerHTML;
    const attributes = this.DOM.attributes;
    const xmlDoc = document.implementation.createDocument(null, 'default');
    const newDOM = xmlDoc.createElement(name);
    newDOM.innerHTML = content;
    for (let i = 0; i < attributes.length; i++) {
      newDOM.setAttribute(attributes[i].nodeName, attributes.nodeValue);
    }
    this.DOM = newDOM;
  }

Should it be newDOM.setAttribute(attributes[i].nodeName, attributes[i].nodeValue); instead? This line was introduce from the commit db90f55.

@limzykenneth
Copy link
Member

It looks like the index is indeed missing from the reference to attributes, you can file a PR to fix this if you like.

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

Successfully merging a pull request may close this issue.

2 participants