fix: textSelection on FireFox

This commit is contained in:
Misko Hevery 2016-05-01 21:50:23 -07:00
parent 6e79de794c
commit 2570b72158
1 changed files with 1 additions and 8 deletions

View File

@ -1236,16 +1236,9 @@ export function main() {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
// In Firefox, effective text selection in the real DOM requires an actual focus
// of the field. This is not an issue in a new HTML document.
if (browserDetection.isFirefox) {
var fakeDoc = getDOM().createHtmlDocument();
getDOM().appendChild(fakeDoc.body, fixture.debugElement.nativeElement);
}
var input = fixture.debugElement.query(By.css("input")).nativeElement;
input.value = "aa";
input.selectionStart = 1;
input.setSelectionRange(1, 2);
dispatchEvent(input, "input");
tick();