mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-13 17:56:59 +00:00
Remove menclose in cancel rendering
Chrome and similar browsers do not support the menclose tag. This change introduces a css polyfill suggested in https://github.com/w3c/mathml-core/issues/245#issuecomment-2410676518 but keeps the mencose rendering since FF does not support the polyfill https://bugzilla.mozilla.org/show_bug.cgi?id=1929800 Bug: T376829 Change-Id: I860e2f2f9bf9eef8eeba35b0999ec50175fdfc4b
This commit is contained in:
parent
4ce41fa717
commit
cc0a214f56
|
@ -79,3 +79,31 @@ mtd.mwe-math-matrix-left {
|
|||
mtd.mwe-math-matrix-right {
|
||||
border-right: 0.06em solid;
|
||||
}
|
||||
|
||||
/* see https://github.com/w3c/mathml-core/issues/245#issuecomment-2410676518 */
|
||||
menclose.menclose {
|
||||
position: relative;
|
||||
padding: 0.5ex 0;
|
||||
}
|
||||
|
||||
mrow.menclose-updiagonalstrike {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 0.5px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: currentcolor;
|
||||
clip-path: polygon( 0.05em 100%, 0 calc( 100% - 0.05em ), calc( 100% - 0.05em ) 0, 100% 0.05em );
|
||||
}
|
||||
|
||||
mrow.menclose-downdiagonalstrike {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 0.5px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: currentcolor;
|
||||
clip-path: polygon( 0 0, 0.05em 0, 100% 100%, calc( 100% - 0.05em ) 100% );
|
||||
}
|
||||
|
|
|
@ -159,10 +159,14 @@ class BaseParsing {
|
|||
return $mrow->encapsulateRaw( $node->getArg()->renderMML( $passedArgs ) );
|
||||
}
|
||||
|
||||
public static function cancel( $node, $passedArgs, $operatorContent, $name, $notation = null, $smth2 = null ) {
|
||||
$mrow = new MMLmrow();
|
||||
$menclose = new MMLmenclose( "", [ "notation" => $notation ] );
|
||||
return $mrow->encapsulateRaw( $menclose->encapsulateRaw( $node->getArg()->renderMML() ) );
|
||||
public static function cancel( Fun1 $node, $passedArgs, $operatorContent, $name, $notation = '' ): string {
|
||||
$outer = new MMLmenclose( '', [ 'notation' => $notation, 'class' => 'menclose' ] );
|
||||
$bars = '';
|
||||
foreach ( explode( ' ', $notation ) as $element ) {
|
||||
$bars .= ( new MMLmrow( '', [ 'class' => 'menclose-' . $element ] ) )->getEmpty();
|
||||
}
|
||||
|
||||
return $outer->encapsulateRaw( $node->getArg()->renderMML() . $bars );
|
||||
}
|
||||
|
||||
public static function cancelTo( $node, $passedArgs, $operatorContent, $name, $notation = null ) {
|
||||
|
|
|
@ -67,7 +67,9 @@ class BaseParsingTest extends TestCase {
|
|||
( new Literal( 'a' ) )
|
||||
);
|
||||
$result = BaseParsing::cancel( $node, [], null, 'cancel', 'something' );
|
||||
$this->assertStringContainsString( '<menclose notation="something"><mi>a</mi></menclose>',
|
||||
$this->assertStringContainsString( '<mi>a</mi><mrow class="menclose-something"/>',
|
||||
$result );
|
||||
$this->assertStringContainsString( '<menclose notation="something" class="menclose">',
|
||||
$result );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue