rename parent_node to parentId, as parentNode is already a DOM property

This commit is contained in:
ralf 2022-07-21 19:29:43 +02:00
parent b9d96ea3e9
commit 39a3ef8183
2 changed files with 23 additions and 22 deletions

View File

@ -346,7 +346,7 @@ function send_template()
(substr($matches[ADD_ET2_PREFIX_LAST_GROUP], -1) === '/' ? substr($matches[ADD_ET2_PREFIX_LAST_GROUP], 0, -1) .
'></et2-' . $matches[3] : $matches[ADD_ET2_PREFIX_LAST_GROUP]) . '>';
}, $str);
}
// change all attribute-names of new et2-* widgets to camelCase
$str = preg_replace_callback('/<et2-([a-z-]+)\s([^>]+)>/', static function(array $matches)
{
@ -357,6 +357,7 @@ function send_template()
{
if (count($parts = preg_split('/[_-]/', $name)) > 1)
{
if ($name === 'parent_node') $parts[1] = 'Id'; // we can not use DOM property parentNode --> parentId
$attrs[array_shift($parts).implode('', array_map('ucfirst', $parts))] = $value;
unset($attrs[$name]);
}
@ -366,7 +367,7 @@ function send_template()
}, array_keys($attrs), $attrs)).(substr($matches[2], -1) === '/' ? '/' : ''), $matches[0]);
return $ret;
}, $str);
}
$processing = microtime(true);
if (isset($cache) && (file_exists($cache_dir = dirname($cache)) || mkdir($cache_dir, 0755, true) || is_dir($cache_dir)))

View File

@ -144,7 +144,7 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
* Widget ID of another node to insert this node into instead of the normal location
* This isn't a normal property...
*/
parent_node: {type: String},
parentId: {type: String},
/**
* Tooltip which is shown for this element on hover
@ -901,7 +901,7 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
*
* @param {string} parent
*/
set parent_node(parent : string | Element)
set parentId(parent : string | Element)
{
if(typeof parent === "string")
{