/src/main/java/org/htmlunit/html/DoTypeProcessor.java
selectionEnd = Math.max( selectionEnd, Math.min( selectionStart, currentValue.length( ) ) ) ;
selectionEnd = Math.max ( selectionStart, Math.min ( selectionEnd, currentValue.length ( ) ) ) ;
} void doType(final String currentValue, final SelectionDelegate selectionDelegate, final int keyCode, final HtmlElement element, final boolean lastType) { int selectionStart = selectionDelegate.getSelectionStart(); selectionStart = Math.max(0, Math.min(selectionStart, currentValue.length())); int selectionEnd = selectionDelegate.getSelectionEnd(); <extra_id_0> final Character ch = SPECIAL_KEYS_MAP_.get(keyCode); if (ch != null) { doType(currentValue, selectionDelegate, ch, element, lastType); return; } final StringBuilder newValue = new StringBuilder(currentValue);