Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated styles and events #75

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions dist/expanding.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,6 @@
(function () {
'use strict';

var userAgent = window.navigator.userAgent

// Returns the version of Internet Explorer or -1
// (indicating the use of another browser).
// From: http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx#ParsingUA
var ieVersion = (function () {
var version = -1
if (window.navigator.appName === 'Microsoft Internet Explorer') {
var regExp = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})')
if (regExp.exec(userAgent) !== null) version = parseFloat(RegExp.$1)
}
return version
})()

// Check for oninput support
// IE9 supports oninput, but not when deleting text, so keyup is used.
// onpropertychange _is_ supported by IE8/9, but may not be fired unless
// attached with `attachEvent`
// (see: http://stackoverflow.com/questions/18436424/ie-onpropertychange-event-doesnt-fire),
// and so is avoided altogether.
var inputEventSupported = (
'oninput' in document.createElement('input') && ieVersion !== 9
)

var inputEvent = inputEventSupported ? 'input' : 'keyup'

var isIosDevice = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream

function wrap (element, wrapper) {
element.parentNode.insertBefore(wrapper, element)
wrapper.appendChild(element)
Expand Down Expand Up @@ -125,8 +97,8 @@ var styleProperties = {
lineHeight: null,
maxHeight: null,
paddingBottom: null,
paddingLeft: paddingHorizontal,
paddingRight: paddingHorizontal,
paddingLeft: null,
paddingRight: null,
paddingTop: null,
textAlign: null,
textDecoration: null,
Expand All @@ -136,10 +108,6 @@ var styleProperties = {
wordWrap: null
}

function paddingHorizontal (computedStyle) {
return isIosDevice ? (parseFloat(computedStyle) + 3) + 'px' : computedStyle
}

function TextareaClone () {
this.element = document.createElement('pre')
this.element.className = 'expanding-clone'
Expand Down Expand Up @@ -194,8 +162,7 @@ function Expanding (textarea) {
this.element.appendChild(this.textareaClone.element)

var inputHandler = this.update.bind(this)
this.textarea.on(inputEvent, inputHandler)
this.textarea.on('change', inputHandler)
this.textarea.on('input', inputHandler)

this.update()
}
Expand Down
39 changes: 3 additions & 36 deletions dist/expanding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,6 @@
(global.Expanding = factory());
}(this, (function () { 'use strict';

var userAgent = window.navigator.userAgent

// Returns the version of Internet Explorer or -1
// (indicating the use of another browser).
// From: http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx#ParsingUA
var ieVersion = (function () {
var version = -1
if (window.navigator.appName === 'Microsoft Internet Explorer') {
var regExp = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})')
if (regExp.exec(userAgent) !== null) version = parseFloat(RegExp.$1)
}
return version
})()

// Check for oninput support
// IE9 supports oninput, but not when deleting text, so keyup is used.
// onpropertychange _is_ supported by IE8/9, but may not be fired unless
// attached with `attachEvent`
// (see: http://stackoverflow.com/questions/18436424/ie-onpropertychange-event-doesnt-fire),
// and so is avoided altogether.
var inputEventSupported = (
'oninput' in document.createElement('input') && ieVersion !== 9
)

var inputEvent = inputEventSupported ? 'input' : 'keyup'

var isIosDevice = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream

function wrap (element, wrapper) {
element.parentNode.insertBefore(wrapper, element)
wrapper.appendChild(element)
Expand Down Expand Up @@ -124,8 +96,8 @@ var styleProperties = {
lineHeight: null,
maxHeight: null,
paddingBottom: null,
paddingLeft: paddingHorizontal,
paddingRight: paddingHorizontal,
paddingLeft: null,
paddingRight: null,
paddingTop: null,
textAlign: null,
textDecoration: null,
Expand All @@ -135,10 +107,6 @@ var styleProperties = {
wordWrap: null
}

function paddingHorizontal (computedStyle) {
return isIosDevice ? (parseFloat(computedStyle) + 3) + 'px' : computedStyle
}

function TextareaClone () {
this.element = document.createElement('pre')
this.element.className = 'expanding-clone'
Expand Down Expand Up @@ -193,8 +161,7 @@ function Expanding (textarea) {
this.element.appendChild(this.textareaClone.element)

var inputHandler = this.update.bind(this)
this.textarea.on(inputEvent, inputHandler)
this.textarea.on('change', inputHandler)
this.textarea.on('input', inputHandler)

this.update()
}
Expand Down
Loading