Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Remove browser sniffing (and therefore bowser) dependency and add support... #2

Closed
wants to merge 1 commit into from

2 participants

Dustan Kasten Rod Vagg
Dustan Kasten

... for MSTransitionEnd event.

Rod Vagg
Owner
rvagg commented April 11, 2012

This is great! Thanks @iamdustan, I'd love to get rid of the bowser dependency, but, your changes will be written over next time ./build is run cause it's from the Bootstrap source. Everything in dist/ is assembled dynamically.
You can rewrite content in the Bootstrap source files by putting an entry in https://github.com/rvagg/ender-bootstrap/blob/master/lib/replacements.js - you could either put all your new code in as a substitution. Give ./build a go to see how it works (summary: clone/pull latest Bootstrap source, open js files, do some basic regex-based replacements, write to dist/ directory) do an npm install first to get the dependencies though.
Perhaps a better solution would be to totally remove transition.js from service, put your code into https://github.com/rvagg/ender-bootstrap/blob/master/base/base.js which doesn't change with each build and contains all of the Ender-specific monkey patching. How does that sound?

Dustan Kasten

After I submitted this I thought of that and decided to go straight to the source. I have a pull request in for twitter-bootstrap to make this exact same change (at which point we won’t need to maintain the fork of it)

Wait a week and see what happens over there?

twbs/bootstrap#3021

Rod Vagg
Owner
rvagg commented April 11, 2012

I have my doubts that'll get in, we'll see tho.

Dustan Kasten

Ha. High hopes. My track record for accepted pull requests is something like 15% so my doubts are with you. ;)

Dustan Kasten

Good news! Just browsed through the 2.0.3-wip branch and see that this is coming in. https://github.com/twitter/bootstrap/blob/2.0.3-wip/js/bootstrap-transition.js

Rod Vagg
Owner
rvagg commented April 11, 2012

brilliant!

Rod Vagg
Owner
rvagg commented April 11, 2012

not long then Bowser can go and IE10 can get transitions: https://twitter.com/#!/fat/status/190287042985459712

If I don't release a 2.0.3 soon after they publish it then you might need to poke me into action.

Rod Vagg
Owner
rvagg commented April 24, 2012

Unfortunately I'm not going to be able to push a 2.0.3 till the weekend cause I'll be away from my desktop where all my test VMs live.
If you're in a hurry though you should be able to run ./build to build yourself a local version, it'll fetch and patch master from twitter/bootstrap.
I'm thinking that I might put in a simple $.index() implementation to base.js so that carousel feature should work too.

Dustan Kasten

No worries. I have a fork of the few pieces I need. I grabbed the typeahead component though and discovered another reference to $.browser so we’re not quite free of bowser. I just cloned down the bootstrap source and that is the only piece left.

https://github.com/twitter/bootstrap/blob/master/js/bootstrap-typeahead.js#L171

Over the next week I’m going to be playing with it to try to remove it safely.

(for the custom build I’m doing, all of my ender modules, ender-bootstrap bits, and project specific js weight is ~20.3KB minified+gzipped. Still 12KB smaller than jQuery.)

Rod Vagg
Owner
rvagg commented April 24, 2012

I'm also interested to see this proj working with the latest ender-js since Dustin changed it to prototypal extension rather than property copying, I can't think of a reason it won't work but base.js does some pretty heavy munging of $.fn, I'll play when I'm back and make sure all's good.

Dustan Kasten

Good point. When Dustin first started 0.4.x reqwest broke so I’ve currently locked myself to 0.3.8 until this project is through.

Rod Vagg
Owner
rvagg commented May 02, 2012

First pass at a working 2.0.3 is in master now but needs more testing across and I might get that $.index() garbage in too prior to a release.
This has been very tricky, @fat has totally gone to the jQuery dark side with this release, using $([]) for simple array manipulation, $.Event() event instantiation for isDefaultPrevented() inspection on trigger() (which we can't support) and other crazyness. I think this has to be called jQueryScript.

Dustan Kasten

What!? Blast! Bootstrap’s stock just crashed.

Rod Vagg
Owner
rvagg commented May 06, 2012

2.0.3 released, still need bowser as a dependency unfortunately because of this one line in typeahead.js, which I don't care to try and understand right now.

fwiw, Qwery is now an optional dependency, any of the 4 Ender selector engines should work with this.

Rod Vagg rvagg closed this May 06, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 11, 2012
Dustan Kasten Remove browser sniffing (and therefor bowser) dependency and add supp…
…ort for MSTransitionEnd event.
d3a9a80
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 18 additions and 15 deletions. Show diff stats Hide diff stats

  1. 33  dist/transition/transition.js
33  dist/transition/transition.js
@@ -26,25 +26,28 @@
26 26
     /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27 27
      * ======================================================= */
28 28
 
  29
+    // quick check to make sure support object exists
  30
+    $.support = $.support || {}
  31
+    
29 32
     $.support.transition = (function () {
30 33
       var thisBody = document.body || document.documentElement
31 34
         , thisStyle = thisBody.style
32  
-        , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
33  
-
34  
-      return support && {
35  
-        end: (function () {
36  
-          var transitionEnd = "TransitionEnd"
37  
-          if ( $.browser.webkit ) {
38  
-          	transitionEnd = "webkitTransitionEnd"
39  
-          } else if ( $.browser.mozilla ) {
40  
-          	transitionEnd = "transitionend"
41  
-          } else if ( $.browser.opera ) {
42  
-          	transitionEnd = "oTransitionEnd"
43  
-          }
44  
-          return transitionEnd
45  
-        }())
  35
+        , transitions = 'transition WebkitTransition MozTransition OTransition MsTransition'.split(' ')
  36
+          
  37
+          // transition end events from https://developer.mozilla.org/en/CSS/CSS_transitions#Browser_compatibility
  38
+        , transitionEnd = 'TransitionEnd webkitTransitionEnd transitionend oTransitionend MSTransitionEnd'.split(' ')
  39
+        , i = transitions.length
  40
+        , support = false
  41
+      while (i--) {
  42
+        if (transitions[i] in thisStyle) {
  43
+          support = transitions[i]
  44
+          transitionEnd = transitionEnd[i]
  45
+          break
  46
+        }
46 47
       }
47  
-    })()
48 48
 
  49
+      return support && { end: transitionEnd }
  50
+  
  51
+    })()
49 52
   })
50 53
 }(require('ender-bootstrap-base'))
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.