-
Notifications
You must be signed in to change notification settings - Fork 3
Support Element.onclick attribute for inline event handlers #309
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
Conversation
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…t integration Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to update the element binding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binding layer changes have been removed as requested. The onclick functionality now works entirely at the C++ level without JavaScript property exposure. (commit a5bd66b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please continue to complete all the TODOs in your code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All TODOs in element.cpp have been completed:
- ✅ V8 execution implementation using DOMScriptingContext
- ✅ Function reference storage in setOnClickHandlerFunction()
- ✅ Click event handler integration via simulateClick()
The onclick functionality now properly compiles and executes JavaScript using the browsing context's scripting infrastructure. (commit a5bd66b)
…tion Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. 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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot You need to display the test results on the page, not just print them to the console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test file updated to display results visually on the page instead of console output. The new interface includes:
- Interactive Test Buttons: Manual testing with visual feedback and animations
- Automated Test Runner: Comprehensive test suite with real-time result display
- Visual Results Panel: Color-coded pass/fail status with detailed logging
- Test Statistics: Live tracking of passed/failed tests
The page now provides a complete visual testing interface that shows all test results directly in the browser UI. (commit b7e9341)
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
This PR implements support for the
onclickattribute on DOM Elements, enabling inline event handler assignments that are standard in web browsers.What's Added
The implementation provides complete onclick attribute support including:
HTML Attribute Support:
Implementation Details
Native Implementation (
src/client/dom/)onclick_handler_code_,has_onclick_function_,onclick_function_ref_) to Element classDOMScriptingContextHTML Integration (
src/client/html/)HTMLElement::attributeChangedCallbackto handleonclickattribute changesEvent Execution
Element::simulateClick()to execute onclick handlers before normal event dispatchTesting
Added comprehensive test file
fixtures/html/element-onclick-test.htmlwith visual test interface:The test file validates:
Web Compatibility
This implementation follows standard web behavior:
addEventListenerhandlersThe implementation works entirely at the native C++ level, providing onclick functionality without JavaScript property exposure. The JavaScript execution infrastructure uses the existing DOMScriptingContext for proper V8 integration.
Fixes #308.
Warning
registry.npmmirror.comnpm ci(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 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.