*/
( function ( $ ) {
+ var eventKeys = [
+ 'keyup.byteLimit',
+ 'keydown.byteLimit',
+ 'change.byteLimit',
+ 'mouseup.byteLimit',
+ 'cut.byteLimit',
+ 'paste.byteLimit',
+ 'focus.byteLimit',
+ 'blur.byteLimit'
+ ].join( ' ' );
+
/**
* Utility function to trim down a string, based on byteLimit
* and given a safe start position. It supports insertion anywhere
};
};
- var eventKeys = [
- 'keyup.byteLimit',
- 'keydown.byteLimit',
- 'change.byteLimit',
- 'mouseup.byteLimit',
- 'cut.byteLimit',
- 'paste.byteLimit',
- 'focus.byteLimit',
- 'blur.byteLimit'
- ].join( ' ' );
-
/**
* Enforces a byte limit on an input field, so that UTF-8 entries are counted as well,
* when, for example, a database field has a byte limit rather than a character limit.
// maxLength is a strange property. Removing or setting the property to
// undefined directly doesn't work. Instead, it can only be unset internally
// by the browser when removing the associated attribute (Firefox/Chrome).
- // http://code.google.com/p/chromium/issues/detail?id=136004
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=136004
$el.removeAttr( 'maxlength' );
} else {
// changed while text is being entered and keyup/change will not be fired yet
// (such as holding down a single key, fires keydown, and after each keydown,
// we can trim the previous one).
- // See http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order for
+ // See https://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order for
// the order and characteristics of the key events.
$el.on( eventKeys, function () {
var res = $.trimByteLength(