Fix category headers showing as raw HTML on New Item page#26055
Fix category headers showing as raw HTML on New Item page#26055Abhijeet212004 wants to merge 1 commit intojenkinsci:masterfrom
Conversation
Use createElementFromHtml() to properly parse HTML strings instead of treating them as plain text. Fixes jenkinsci#26053
|
I wasn't able to add the following labels: regression-fix web-ui Check that the label exists and is spelt right then try again. |
|
Missing required label for changelog. Requires at least 1 of: bug, developer, dependencies, internal, localization, major-bug, major-rfe, rfe, regression-fix, removed, skip-changelog. Found: . You can add the required label by adding a comment with the following text: |
|
I wasn't able to add the following labels: regression-fix web-ui Check that the label exists and is spelt right then try again. |
|
I wasn't able to add the following labels: regression-fix web-ui Check that the label exists and is spelt right then try again. |
|
I wasn't able to add the following labels: regression-fix web-ui Check that the label exists and is spelt right then try again. |
Fixes #26053
When the
flatclass is removed from the items container on the New Item page, category titles and descriptions show up as raw HTML text (like<h2>Freestyle projects</h2>) instead of being rendered as proper HTML elements.This is a regression from PR #10208 which migrated the page from jQuery to vanilla JavaScript. The problem is that jQuery's
.append()automatically parses HTML strings, but vanilla JS.append()treats strings as plain text nodes.The fix: I wrapped the title and description strings with
createElementFromHtml()before appending them. This function is already imported and used elsewhere in the same file (lines 123, 128, 129), so it's following the existing pattern.Testing done
I tested this by:
node --checkon the file - no syntax errorscreateElementFromHtml()is imported at the top and already used in the same way elsewherenpm run devScreenshots (UI changes only)
Before
Categories display as literal HTML strings (
<h2>Freestyle projects</h2><p>This is the central feature...</p>) instead of rendered elements. This happens when theflatclass is removed fromdiv#itemsas documented in issue #26053.After
Categories render correctly with properly formatted h2 headings and paragraph text.
Proposed changelog entries
Proposed changelog category
/label regression-fix web-ui
Proposed upgrade guidelines
N/A
Submitter checklist
eval.Desired reviewers
@daniel-beck @jenkinsci/core-pr-reviewers