fix(builder_page): use originalElement for body scripts check in build_tag()#497
Merged
surajshetty3416 merged 1 commit intofrappe:developfrom Feb 21, 2026
Conversation
In build_tag(), the condition to inject page scripts was using
block.get('element') == 'body', but create_html_tag() uses
block.get('originalElement') or block.get('element') to determine
the actual HTML element.
Pages created in the Builder UI store the root block with
originalElement='body' and element='div'. Because of this mismatch,
the body check in build_tag() always evaluated to False and
webpage_scripts.html was never included in the final HTML, causing
all page-level client scripts (Builder Client Scripts) to not load.
Fixed by using the same originalElement-first logic as create_html_tag().
Regression introduced in eb9776c (refactor: broke get_tag into
smaller readable functions).
Member
|
@jmadridv thanks for noticing and raising a fix. |
surajshetty3416
approved these changes
Feb 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #497 +/- ##
===========================================
+ Coverage 60.61% 60.66% +0.04%
===========================================
Files 28 28
Lines 2722 2720 -2
===========================================
Hits 1650 1650
+ Misses 1072 1070 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
stravo1
added a commit
to stravo1/builder
that referenced
this pull request
Feb 21, 2026
…ruct updating test cases in response to frappe#497
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Client scripts (JS) attached to Builder pages stopped loading after the refactor
in eb9776c. The root block of every page is stored as:
{ "element": "div", "originalElement": "body" }elementis"div"because<body>cannot be nested inside the Jinja wrappertemplate. The semantic identity is preserved in
originalElement.build_tag()checkedblock.get("element") == "body", which is neverTrue,so
set_style_and_script()was never called and no<script>tags were injected.Solution
Use the same
originalElement or elementpattern already present increate_html_tag()andbuild_tag_classes():Regression introduced by eb9776c.