Loose checking for calling JavaScript theme function

Created on 17 March 2025, 23 days ago

Problem/Motivation

JavaScript theme functions are defined on each library and Drupal.theme() checks property existence. But, a type of property value is not checked so that if a JavaScript theme function is defined other than function, tries to execute as function and occurs an error.

Drupal.theme.test = true;

Drupal.theme.test2 = function() {
	// Try to execute Drupal.theme.test() as a function but an error is occurred.
	return Drupal.theme('test', false);
}

Proposed resolution

Checks property value type using typeof operator.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

javascript

Created by

πŸ‡―πŸ‡΅Japan tom konda Kanagawa, Japan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024