Complete JavaScript integration Phase 3 and comprehensive review

This commit completes Phase 3 (Event System) and includes a thorough
midpoint review that identified and fixed critical gaps from earlier phases.

Major accomplishments:
• Complete event system with addEventListener/removeEventListener API
• Event dispatch system with preventDefault/stopPropagation support
• Click event integration with w3m's existing mouse handling system
• Enhanced document.write() from stub to functional implementation
• Fixed critical anchor-DOM integration gap from Phase 2
• Comprehensive code review and stub elimination
• Full DOM element extraction and JavaScript object conversion
• Working noscript tag suppression when JavaScript is enabled

Testing verified:
• JavaScript execution and DOM manipulation working correctly
• document.write() creates DOM elements and displays content properly
• noscript content correctly hidden when JavaScript is enabled
• Click events integrate properly with w3m's mouse system
• No compilation errors or warnings (except minor unused variable)

Phase status: Phases 1-3 now complete and fully functional.
Remaining stubs are safe and won't cause unexpected behavior.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Storm Dragon
2025-08-17 14:11:50 -04:00
parent 5738cf9132
commit 98833568db
11 changed files with 677 additions and 66 deletions

6
fm.h
View File

@@ -423,6 +423,9 @@ typedef struct _anchor {
#ifdef USE_IMAGE
Image *image;
#endif
#ifdef USE_JAVASCRIPT
struct W3MElement *element; /* Associated DOM element */
#endif
} Anchor;
#define NO_REFERER ((char*)-1)
@@ -639,6 +642,9 @@ struct readbuffer {
short table_level;
short nobr_level;
Anchor anchor;
#ifdef USE_JAVASCRIPT
struct W3MElement *anchor_element; /* DOM element for current anchor */
#endif
Str img_alt;
struct input_alt_attr input_alt;
char fontstat[FONTSTAT_SIZE];