* zin: auto set rel=noopener for external link

This commit is contained in:
sunhao
2023-05-04 15:07:16 +08:00
parent 20e548e422
commit cade2fe9b1
+7
View File
@@ -100,6 +100,13 @@ class h extends wg
return new h(prop('tagName', $tagName), $args);
}
public static function a()
{
$a = static::create('a', func_get_args());
if($a->prop('target') === '_blank' && !$a->hasProp('rel')) $a->prop('rel', 'noopener noreferrer');
return $a;
}
public static function button()
{
return static::create('button', prop('type', 'button'), func_get_args());