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

Fix setElementContents for outerHTML #4182

Conversation

ThoWagen
Copy link
Contributor

@ThoWagen ThoWagen commented Jan 9, 2025

Fixing a bug discovered in #3918

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ThoWagen -- just one small suggestion!

if (property !== 'outerHTML') {
// Set any attributes (N.B. has to be done before scripts in case they rely on the attributes):
Object.entries(attrs).forEach(([attr, value]) => elm.setAttribute(attr, value));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we perhaps add something like:

Suggested change
}
} else {
console.error("Incompatible parameters passed to setElementContents().");
}

...just so there's a bit of feedback if somebody attempts something illegal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but only when the 'attrs' is actually not empty. I added it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point -- thanks!

@demiankatz demiankatz added this to the 11.0 milestone Jan 9, 2025
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ThoWagen! Looks good, and all tests are passing on my end.

@demiankatz demiankatz merged commit 0f90fbc into vufind-org:dev Jan 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants