dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.57k forks source link

Custom NodeValidator refuses mathml elements. #27774

Open ktullavik opened 7 years ago

ktullavik commented 7 years ago

I can not get the validator to accept mathml tags. Example:

import 'dart:html';

void main() {
    var validator = new NodeValidatorBuilder();
    validator.allowElement('math');
    validator.allowElement('mtext');
    querySelector('body').setInnerHtml('<math><mtext>Test MathML</mtext></math>', validator: validator);
}

gives console output: Removing disallowed element from [object DocumentFragment] Removing disallowed element from math.

The allowElement method just calls allowCustomElement internally so that's not the issue.

alan-knight commented 7 years ago

The underlying problem is that the validator has the tag name in upper case and is checking it against the lower case version it's getting from the element. For built-in elements the tag-name does come back in uppercase. This might be as simple as adding a toUpperCase, but validation is tricky, so I'd want to investigate this more carefully.

ktullavik commented 7 years ago

Sorry to be that guy, but is there any news on this bug? It's a shame having to setup your own validation or worse, just because of a case bug in dart.