[Webkit-unassigned] [Bug 148177] New: Replacing input element using outerHTML with new element containing "autofocus" focuses newly replaced element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Aug 19 07:00:50 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=148177
Bug ID: 148177
Summary: Replacing input element using outerHTML with new
element containing "autofocus" focuses newly replaced
element
Classification: Unclassified
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: HTML DOM
Assignee: webkit-unassigned at lists.webkit.org
Reporter: martijn.dashorst at gmail.com
When replacing an existing <input> element using outerHTML where the new markup has <input autofocus> puts the focus on the new element instead of keeping the focus on the current form element.
The markup below illustrates the issue:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function replaceLastName() {
var newMarkup = "<input type='text' id='lastname' autofocus placeholder='Last name' value='Banana'>";
document.getElementById("lastname").outerHTML = newMarkup;
}
</script>
</head>
<body>
<form>
<input type="text" id="lastname" autofocus placeholder="Last name">
<input type="text" id="firstname" placeholder="First name" onfocus="replaceLastName();">
<input type="submit">
</form>
</body>
</html>
When you modify the contents of field 'lastname' and switch the focus to 'firstname', Safari 8 and Webkit nightly remove the focus from the 'firstname' field and put the focus on 'lastname'.
All other major browsers retain the focus on the 'firstname' field.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150819/21cc923e/attachment.html>
More information about the webkit-unassigned
mailing list