Project

General

Profile

Actions

Bug #13501

closed

Avoid inline events, in favour of JavaScript events

Added by Matthias Van Ceulebroeck 16 days ago. Updated 4 days ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
02/06/2025
Due date:
% Done:

100%

Estimated time:

Description

With the introduction of CSP, if enabled, the default will not use unsafe-inline. This block inline JavaScript handlers from running. A DOM element like <div onclick="doSomething()">Click me!</div> will not be allowed to run.
The browser will block this event handler from running.

There are several places where we do rely on this. They should be replaced in favor of pure JavaScript functionality. An easy equivalent is when having a <div id="{id}">Click me!</div>, to define a Wt.$('{id}').onclick = doSomething(); This completely equivalent, and allowed by the CSP, since all JavaScript that is executed is done so from the context of the initial framework set-up, which passed the nonce test, and can execute any JavaScript from it, thanks for strict-dynamic.

Actions #1

Updated by Matthias Van Ceulebroeck 11 days ago

  • Status changed from InProgress to Review
  • Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
Actions #2

Updated by Matthias Van Ceulebroeck 11 days ago

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Romain Mardulyn to Matthias Van Ceulebroeck
  • % Done changed from 0 to 100
Actions #3

Updated by Matthias Van Ceulebroeck 4 days ago

  • Status changed from Implemented @Emweb to Implemented @Test
Actions #4

Updated by Matthias Van Ceulebroeck 4 days ago

  • Status changed from Implemented @Test to Closed
Actions

Also available in: Atom PDF