-
-
Notifications
You must be signed in to change notification settings - Fork 283
Add support for data-src attribute in IFRAME elements with src priority #1497
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
Add support for data-src attribute in IFRAME elements with src priority #1497
Conversation
Co-authored-by: daohoangson <[email protected]>
Co-authored-by: daohoangson <[email protected]>
Demo app2f5dbf0 APKs:
Web build has been deployed to https://demo-8sk55o7u9-fwfh.vercel.app. Quick links: |
|
@copilot fix failing unit test. Also, src should have a higher priority than data-src. |
Co-authored-by: daohoangson <[email protected]>
Fixed the priority logic to make Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…9-cf46-40ae-8035-13be4a475bce
|



This PR adds support for the
data-srcattribute in IFRAME elements, treating it as a fallback when the traditionalsrcattribute is empty or missing. This enables common lazy loading and progressive enhancement patterns used in modern web development.Problem
Currently, the library only recognizes the
srcattribute for IFRAME elements. Many web applications use thedata-srcattribute for lazy loading scenarios where:data-srccontains the actual URL to loadsrcis initially empty or contains a placeholdersrcfromdata-srcwhen the iframe enters the viewportSolution
Implemented attribute priority logic that:
srcwhen present and non-empty (highest priority)data-srcwhensrcis empty or missingsrc-only iframesUsage Examples
Traditional usage (unchanged, highest priority)
Progressive enhancement (src takes priority)
Fallback behavior (empty src uses data-src)
Data-src only usage
Implementation Details
kAttributeIframeDataSrc = 'data-src'constantWebViewFactory.parse():Testing
Added test cases covering:
All existing functionality remains unchanged, ensuring no breaking changes for current users.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.