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 bug on HTML tree #561

Merged
merged 1 commit into from
Jul 6, 2024
Merged

fix bug on HTML tree #561

merged 1 commit into from
Jul 6, 2024

Conversation

LawyZheng
Copy link
Collaborator

@LawyZheng LawyZheng commented Jul 6, 2024

🚀 This description was created by Ellipsis for commit 3e28191

Summary:

Fixed self-closing tag logic in json_to_html function to correctly handle option_html and children_html content.

Key points:

  • File Modified: skyvern/webeye/scraper/scraper.py
  • Function Modified: json_to_html
  • Bug Fix: Corrected self-closing tag logic to check for absence of option_html and children_html.
  • Behavior Change: Self-closing tags like img, input, br, hr, meta, and link will only be self-closed if they have no option_html or children_html content.

Generated with ❤️ by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 3e28191 in 34 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_bZXCAMNLzqE3LYFv


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -96,7 +96,7 @@ def json_to_html(element: dict) -> str:
)

# Check if the element is self-closing
if tag in ["img", "input", "br", "hr", "meta", "link"]:
if tag in ["img", "input", "br", "hr", "meta", "link"] and not option_html and not children_html:
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition for adding space before attributes_html is redundant and can be simplified. Consider revising it to ensure correct spacing only when attributes_html is not empty.

Suggested change
if tag in ["img", "input", "br", "hr", "meta", "link"] and not option_html and not children_html:
return f'<{tag}{" "+attributes_html if attributes_html else ""}>'

@LawyZheng LawyZheng merged commit 7a75bb3 into main Jul 6, 2024
2 checks passed
@LawyZheng LawyZheng deleted the fix-lost-combobox-option branch July 6, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant