Commit 9fb38015 authored by Mark Otto's avatar Mark Otto

Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip

Conflicts:
	bootstrap.css
	docs/javascript.html
parents 12a0d694 a5a98a8a
......@@ -6,7 +6,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
* Date: Wed Dec 21 18:20:33 CST 2011
* Date: Wed Dec 21 18:38:56 CST 2011
*/
html, body {
margin: 0;
......@@ -2466,6 +2466,18 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
-moz-opacity: 0.8;
opacity: 0.8;
}
.twipsy.above {
margin-top: -2px;
}
.twipsy.right {
margin-left: 2px;
}
.twipsy.below {
margin-top: 2px;
}
.twipsy.left {
margin-left: -2px;
}
.twipsy.above .twipsy-arrow {
bottom: 0;
left: 50%;
......@@ -2522,6 +2534,18 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
display: none;
padding: 5px;
}
.popover.above {
margin-top: -5px;
}
.popover.right {
margin-left: 5px;
}
.popover.below {
margin-top: 5px;
}
.popover.left {
margin-left: -5px;
}
.popover.above .arrow {
bottom: 0;
left: 50%;
......
......@@ -321,13 +321,21 @@ button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;
.modal-footer:after{clear:both;}
.modal-footer .btn{float:right;margin-left:5px;}
.twipsy{position:absolute;z-index:1000;display:block;visibility:visible;padding:5px;font-size:11px;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;}.twipsy.in{filter:alpha(opacity=80);-moz-opacity:0.8;opacity:0.8;}
.twipsy.above{margin-top:-2px;}
.twipsy.right{margin-left:2px;}
.twipsy.below{margin-top:2px;}
.twipsy.left{margin-left:-2px;}
.twipsy.above .twipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
.twipsy.left .twipsy-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
.twipsy.below .twipsy-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
.twipsy.right .twipsy-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
.twipsy-inner{max-width:200px;padding:3px 8px;color:white;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.twipsy-arrow{position:absolute;width:0;height:0;}
.popover{position:absolute;top:0;left:0;z-index:1000;display:none;padding:5px;}.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
.popover{position:absolute;top:0;left:0;z-index:1000;display:none;padding:5px;}.popover.above{margin-top:-5px;}
.popover.right{margin-left:5px;}
.popover.below{margin-top:5px;}
.popover.left{margin-left:-5px;}
.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
.popover.below .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
......
......@@ -68,7 +68,7 @@ $(function(){
// POSITION STATIC TWIPSIES
// ========================
$(window).bind( 'load resize', function () {
$(window).on('load resize', function () {
$(".twipsies a").each(function () {
$(this)
.twipsy({
......
This diff is collapsed.
## 2.0 BOOTSTRAP JS PHILOSOPHY
These are the high-level design rules which guide the development of Bootstrap's JS plugins.
These are the high-level design rules which guide the development of Bootstrap's plugin apis.
---
......@@ -9,11 +9,11 @@ We believe you should be able to use all plugins provided by Bootstrap purely th
We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
$('body').unbind('.data-api')
$('body').off('.data-api')
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
$('body').unbind('.alert.data-api')
$('body').off('.alert.data-api')
---
......@@ -21,17 +21,19 @@ To target a specific plugin, just include the plugins name as a namespace along
We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API.
All public APIs should be a single, chainable method, and return the collection acted upon.
All public APIs should be single, chainable methods, and return the collection acted upon.
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
$("#myModal").modal() // initialized with defaults
$("#myModal").modal({ keyboard: false }) // initialized with now keyboard
$("#myModal").modal('show') // initializes and invokes show immediately afterqwe2
---
### PLUGIN OPTIONS
### OPTIONS
Options should be sparse and add universal value. We should pick the right defaults.
......@@ -51,7 +53,7 @@ examples:
---
### PLUGIN EVENTS
### EVENTS
All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
......@@ -60,20 +62,36 @@ All events should have an infinitive and past participle form. The infinitive is
---
### CONSTRUCTORS
Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way:
$.fn.popover.Constructor
---
### DATA ACCESSOR
Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data api like this:
$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
---
### DATA ATTRIBUTES
Data attributes should take the following form:
- data-*(verb)* - defines main interaction
- data-target || href^=# - defined on controller element (if element interacts with an element other than self)
- data-*(noun)* - defines options for element invocation
- data-{{verb}}={{plugin}} - defines main interaction
- data-target || href^=# - defined on "control" element (if element controls an element other than self)
- data-{{noun}} - defines class instance options
examples:
// control other targets
data-toggle="modal" data-target="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#bar"
// defined on element they control
data-spy="scroll"
......
......@@ -27,7 +27,7 @@
var dismiss = '[data-dismiss="alert"]'
, Alert = function ( el ) {
$(el).delegate(dismiss, 'click', this.close)
$(el).on('click', dismiss, this.close)
}
Alert.prototype = {
......@@ -35,18 +35,22 @@
constructor: Alert
, close: function ( e ) {
var $element = $(this)
var $this = $(this)
, selector = $this.attr('data-target') || $this.attr('href')
, $parent = $(selector)
$element = $element.hasClass('alert-message') ? $element : $element.parent()
e && e.preventDefault()
$element.removeClass('in')
$parent.length || ($parent = $this.hasClass('alert-message') ? $this : $this.parent())
$parent.removeClass('in')
function removeElement() {
$element.remove()
$parent.remove()
}
$.support.transition && $element.hasClass('fade') ?
$element.bind($.support.transition.end, removeElement) :
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
......@@ -65,14 +69,14 @@
})
}
$.fn.alert.Alert = Alert
$.fn.alert.Constructor = Alert
/* ALERT DATA-API
* ============== */
$(function () {
$('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -24,16 +24,16 @@
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function (element, options) {
var Button = function ( element, options ) {
this.$element = $(element)
this.settings = $.extend({}, $.fn.button.defaults, options)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype = {
constructor: Button
, setState: function (state) {
, setState: function ( state ) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
......@@ -42,7 +42,7 @@
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.settings[state])
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
......@@ -83,16 +83,16 @@
loadingText: 'loading...'
}
$.fn.button.Button = Button
$.fn.button.Constructor = Button
/* BUTTON DATA-API
* =============== */
$(function () {
$('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
$(e.srcElement).button('toggle')
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -25,8 +25,8 @@
/* CAROUSEL CLASS DEFINITION
* ========================= */
var Carousel = function ( el ) {
$(el).delegate(dismiss, 'click', this.close)
var Carousel = function () {
}
Carousel.prototype = {
......@@ -40,20 +40,12 @@
$.fn.carousel = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
if (!data) $this.data('alert', (data = new Alert(this)))
, data = $this.data('carousel')
if (!data) $this.data('carousel', (data = new Carousel(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.carousel.Carousel = Carousel
/* CAROUSEL DATA-API
* ================= */
// $(function () {
// $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
// })
$.fn.carousel.Constructor = Carousel
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -23,13 +23,13 @@
var Collapse = function ( element, options ) {
this.$element = $(element)
this.settings = $.extend({}, $.fn.collapse.defaults, options)
this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.settings["parent"]) {
this.$parent = $(this.settings["parent"])
if (this.options["parent"]) {
this.$parent = $(this.options["parent"])
}
this.settings.toggle && this.toggle()
this.options.toggle && this.toggle()
}
Collapse.prototype = {
......@@ -116,20 +116,20 @@
toggle: true
}
$.fn.collapse.Collapse = Collapse
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
* ==================== */
$(function () {
$('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('collapse') ? 'toggle' : $this.data()
e.preventDefault()
e.preventDefault()
$(target).collapse(option)
})
})
})( window.jQuery || window.ender )
\ No newline at end of file
})( window.jQuery )
\ No newline at end of file
......@@ -35,11 +35,15 @@
constructor: Dropdown
, toggle: function ( e ) {
var li = $(this).parent('li')
, isActive = li.hasClass('open')
var $this = $(this)
, selector = $this.attr('data-target') || $this.attr('href')
, $parent = $(selector)
$parent.length || ($parent = $this.parent())
clearMenus()
!isActive && li.toggleClass('open')
!$parent.hasClass('open') && $parent.toggleClass('open')
return false
}
......@@ -47,7 +51,7 @@
}
function clearMenus() {
$(toggle).parent('li').removeClass('open')
$(toggle).parent().removeClass('open')
}
......@@ -63,13 +67,15 @@
})
}
$.fn.dropdown.Constructor = Dropdown
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(function () {
$('html').bind('click.dropdown.data-api', clearMenus)
$('body').delegate(toggle, 'click.dropdown.data-api', Dropdown.prototype.toggle)
$('html').on('click.dropdown.data-api', clearMenus)
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -26,10 +26,9 @@
* ====================== */
var Modal = function ( content, options ) {
this.settings = $.extend({}, $.fn.modal.defaults, options)
this.options = $.extend({}, $.fn.modal.defaults, options)
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
this.settings.show && this.show()
}
Modal.prototype = {
......@@ -97,7 +96,7 @@
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.unbind($.support.transition.end)
that.$element.off($.support.transition.end)
hideModal.call(that)
}, 500)
......@@ -107,7 +106,7 @@
})
}
function hideModal (that) {
function hideModal( that ) {
this.$element
.hide()
.trigger('hidden')
......@@ -115,17 +114,17 @@
backdrop.call(this)
}
function backdrop ( callback ) {
function backdrop( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.settings.backdrop) {
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if (this.settings.backdrop != 'static') {
if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
......@@ -156,12 +155,12 @@
function escape() {
var that = this
if (this.isShown && this.settings.keyboard) {
$(document).bind('keyup.dismiss.modal', function ( e ) {
if (this.isShown && this.options.keyboard) {
$(document).on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
$(document).unbind('keyup.dismiss.modal')
$(document).off('keyup.dismiss.modal')
}
}
......@@ -176,29 +175,30 @@
, options = typeof option == 'object' && option
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Modal = Modal
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
* ============== */
$(document).ready(function () {
$('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('modal') ? 'toggle' : $this.data()
, $target = $($this.attr('data-target') || $this.attr('href'))
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
e.preventDefault()
$(target).modal(option)
$target.modal(option)
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -23,16 +23,13 @@
"use strict"
var Popover = function ( element, options ) {
this.$element = $(element)
this.options = options
this.enabled = true
this.fixTitle()
this.init('popover', element, options)
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
========================================= */
Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
Popover.prototype = $.extend({}, $.fn.twipsy.Constructor.prototype, {
constructor: Popover
......@@ -53,22 +50,20 @@
, getContent: function () {
var content
, $e = this.$element
, o = this.options
, $e = this.$element
, o = this.options
if (typeof this.options.content == 'string') {
content = $e.attr(this.options.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
content = $e.attr('data-content')
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
content = content.toString().replace(/(^\s*|\s*$)/, "")
return content
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="popover" />')
.html(this.options.template)
this.$tip = $(this.options.template)
}
return this.$tip
}
......@@ -79,18 +74,22 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
$.fn.popover = function (options) {
if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
$.fn.twipsy.initWith.call(this, options, Popover, 'popover')
return this
$.fn.popover = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('popover')
, options = typeof option == 'object' && option
if (!data) $this.data('popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.popover.Constructor = Popover
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
placement: 'right'
, content: 'data-content'
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
})
$.fn.twipsy.rejectAttrOptions.push( 'content' )
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -27,11 +27,11 @@
function ScrollSpy( element ) {
var process = $.proxy(this.process, this)
this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
this.$scrollElement = $(element).on('scroll.scroll.data-api', process)
this.selector = (this.$scrollElement.attr('data-target')
|| this.$scrollElement.attr('href')
|| '') + ' .nav li > a'
this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
this.$body = $('body').on('click.scroll.data-api', this.selector, process)
this.refresh()
this.process()
......@@ -103,7 +103,7 @@
})
}
$.fn.scrollspy.ScrollSpy = ScrollSpy
$.fn.scrollspy.Constructor = ScrollSpy
/* SCROLLSPY DATA-API
......@@ -111,4 +111,4 @@
$(function () { $('[data-spy="scroll"]').scrollspy() })
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -52,26 +52,45 @@
$href = $(href)
this.activate($this.parent('li'), $ul)
this.activate($href, $href.parent())
$this.trigger({
type: 'shown'
, relatedTarget: previous
this.activate($href, $href.parent(), function () {
$this.trigger({
type: 'shown'
, relatedTarget: previous
})
})
}
, activate: function ( element, container ) {
container
.find('> .active')
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
, activate: function ( element, container, callback) {
var $active = container.find('> .active')
, transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
element.addClass('active')
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
}
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active.one($.support.transition.end, next) :
next()
$active.removeClass('in')
}
}
......@@ -79,7 +98,7 @@
/* TAB PLUGIN DEFINITION
* ===================== */
$.fn.tab = function (option) {
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
......@@ -88,17 +107,17 @@
})
}
$.fn.tab.Tab = Tab
$.fn.tab.Constructor = Tab
/* TAB DATA-API
* ============ */
$(document).ready(function () {
$('body').delegate('[data-toggle="tab"], [data-toggle="pill"]', 'click.tab.data-api', function (e) {
$(function () {
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
/* ===================================================
* bootstrap-transitions.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html
* ===================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
$(function () {
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support && {
end: (function () {
var transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
transitionEnd = "oTransitionEnd"
}
return transitionEnd
}())
}
})()
})
\ No newline at end of file
/* ==========================================================
* bootstrap-twipsy.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#twipsy
* Adapted from the original jQuery.tipsy by Jason Frame
* Inspired by the original jQuery.tipsy by Jason Frame
* ==========================================================
* Copyright 2011 Twitter, Inc.
*
......@@ -26,29 +26,90 @@
* ============================== */
var Twipsy = function ( element, options ) {
this.$element = $(element)
this.options = options
this.enabled = true
this.fixTitle()
this.init('twipsy', element, options)
}
Twipsy.prototype = {
constructor: Twipsy
, show: function() {
var pos
, init: function ( type, element, options ) {
var eventIn
, eventOut
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.enabled = true
if (this.options.trigger != 'manual') {
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
, getOptions: function ( options ) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
return options
}
, enter: function ( e ) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) {
self.show()
} else {
self.hoverState = 'in'
setTimeout(function() {
if (self.hoverState == 'in') {
self.show()
}
}, self.options.delay.show)
}
}
, leave: function ( e ) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.hide) {
self.hide()
} else {
setTimeout(function() {
self.hoverState = 'out'
if (self.hoverState == 'out') {
self.hide()
}
}, self.options.delay.hide)
}
}
, show: function () {
var $tip
, pos
, actualWidth
, actualHeight
, placement
, $tip
, tp
if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
if (this.options.animate) {
if (this.options.animation) {
$tip.addClass('fade')
}
......@@ -69,16 +130,16 @@
switch (placement) {
case 'below':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'above':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
break
case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
break
}
......@@ -95,7 +156,7 @@
$tip[0].className = 'twipsy'
}
, hide: function() {
, hide: function () {
var that = this
, $tip = this.tip()
......@@ -106,11 +167,11 @@
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip.bind( $.support.transition.end, removeElement) :
$tip.on($.support.transition.end, removeElement) :
removeElement()
}
, fixTitle: function() {
, fixTitle: function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
......@@ -121,29 +182,24 @@
return this.getTitle()
}
, getTitle: function() {
, getTitle: function () {
var title
, $e = this.$element
, o = this.options
this.fixTitle()
if (typeof o.title == 'string') {
title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
} else if (typeof o.title == 'function') {
title = o.title.call($e[0])
}
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
title = ('' + title).replace(/(^\s*|\s*$)/, "")
title = title.toString().replace(/(^\s*|\s*$)/, "")
return title
return title
}
, tip: function() {
return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
, tip: function () {
return this.$tip = this.$tip || $(this.options.template)
}
, validate: function() {
, validate: function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
......@@ -151,15 +207,15 @@
}
}
, enable: function() {
, enable: function () {
this.enabled = true
}
, disable: function() {
, disable: function () {
this.enabled = false
}
, toggleEnabled: function() {
, toggleEnabled: function () {
this.enabled = !this.enabled
}
......@@ -177,118 +233,30 @@
return typeof thing == 'function' ? thing.apply(ctx, args) : thing
}
/* TWIPSY PLUGIN DEFINITION
* ======================== */
$.fn.twipsy = function (options) {
$.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
return this
}
$.fn.twipsy.initWith = function (options, Base, name) {
var twipsy
, binder
, eventIn
, eventOut
if (typeof options == 'string') {
return this.each(function (){
twipsy = $.data(this, name)
if (twipsy) twipsy[options]()
})
}
options = $.extend({}, $.fn[name].defaults, options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
function get(ele) {
var twipsy = $.data(ele, name)
if (!twipsy) {
twipsy = new Base(ele, $.fn.twipsy.elementOptions(ele, options))
$.data(ele, name, twipsy)
}
return twipsy
}
function enter() {
var twipsy = get(this)
twipsy.hoverState = 'in'
if (!options.delay || !options.delay.show) {
twipsy.show()
} else {
twipsy.fixTitle()
setTimeout(function() {
if (twipsy.hoverState == 'in') {
twipsy.show()
}
}, options.delay.show)
}
}
function leave() {
var twipsy = get(this)
twipsy.hoverState = 'out'
if (!options.delay || !options.delay.hide) {
twipsy.hide()
} else {
setTimeout(function() {
if (twipsy.hoverState == 'out') {
twipsy.hide()
}
}, options.delay.hide)
}
}
if (!options.live) {
this.each(function() {
get(this)
})
}
if (options.trigger != 'manual') {
binder = options.live ? 'live' : 'bind'
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
this[binder](eventIn, enter)[binder](eventOut, leave)
}
return this
$.fn.twipsy = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('twipsy')
, options = typeof option == 'object' && option
if (!data) $this.data('twipsy', (data = new Twipsy(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.twipsy.Twipsy = Twipsy
$.fn.twipsy.Constructor = Twipsy
$.fn.twipsy.defaults = {
animate: true
animation: true
, delay: 0
, selector: false
, placement: 'above'
, live: false
, offset: 0
, trigger: 'hover'
, title: 'title'
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
}
$.fn.twipsy.rejectAttrOptions = [ 'title' ]
$.fn.twipsy.elementOptions = function(ele, options) {
var data = $(ele).data()
, rejects = $.fn.twipsy.rejectAttrOptions
, i = rejects.length
while (i--) {
delete data[rejects[i]]
}
return $.extend({}, options, data)
, title: ''
, template: '<div class="twipsy"><div class="twipsy-arrow"></div><div class="twipsy-inner"></div></div>'
}
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery )
\ No newline at end of file
......@@ -4,28 +4,36 @@
<title>Bootstrap Plugin Test Suite</title>
<!-- jquery -->
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<!--<script src="http://code.jquery.com/jquery-1.7.min.js"></script>-->
<script src="vendor/jquery.js"></script>
<!-- qunit -->
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
<script src="vendor/qunit.js"></script>
<!-- plugin sources -->
<script src="../../js/bootstrap-transitions.js"></script>
<script src="../../js/bootstrap-alerts.js"></script>
<script src="../../js/bootstrap-transition.js"></script>
<script src="../../js/bootstrap-alert.js"></script>
<script src="../../js/bootstrap-button.js"></script>
<script src="../../js/bootstrap-collapse.js"></script>
<script src="../../js/bootstrap-dropdown.js"></script>
<script src="../../js/bootstrap-modal.js"></script>
<script src="../../js/bootstrap-tabs.js"></script>
<script src="../../js/bootstrap-scrollspy.js"></script>
<script src="../../js/bootstrap-tab.js"></script>
<script src="../../js/bootstrap-twipsy.js"></script>
<script src="../../js/bootstrap-popover.js"></script>
<!-- unit tests -->
<script src="unit/bootstrap-alerts.js"></script>
<script src="unit/bootstrap-transition.js"></script>
<script src="unit/bootstrap-alert.js"></script>
<script src="unit/bootstrap-button.js"></script>
<script src="unit/bootstrap-collapse.js"></script>
<script src="unit/bootstrap-dropdown.js"></script>
<script src="unit/bootstrap-modal.js"></script>
<script src="unit/bootstrap-popover.js"></script>
<script src="unit/bootstrap-tabs.js"></script>
<script src="unit/bootstrap-scrollspy.js"></script>
<script src="unit/bootstrap-tab.js"></script>
<script src="unit/bootstrap-twipsy.js"></script>
<script src="unit/bootstrap-popover.js"></script>
<body>
<div>
......@@ -33,7 +41,7 @@
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-runoff"></div>
<div id="qunit-fixture"></div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -12,7 +12,7 @@ $(function () {
test("should fade element out on clicking .close", function () {
var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#">×</a>'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).alert()
......@@ -26,16 +26,16 @@ $(function () {
$.support.transition = false
var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#">×</a>'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).appendTo('#qunit-runoff').alert()
, alert = $(alertHTML).appendTo('#qunit-fixture').alert()
ok($('#qunit-runoff').find('.alert-message').length, 'element added to dom')
ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
alert.find('.close').click()
ok(!$('#qunit-runoff').find('.alert-message').length, 'element removed from dom')
ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
})
})
\ No newline at end of file
$(function () {
module("bootstrap-buttons")
test("should be defined on jquery object", function () {
ok($(document.body).button, 'tabs method is defined')
})
test("should return element", function () {
ok($(document.body).button()[0] == document.body, 'document.body returned')
})
test("should return set state to loading", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equals(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading')
equals(btn.html(), 'fat', 'btn text equals fat')
stop()
setTimeout(function () {
ok(btn.attr('disabled'), 'btn is disabled')
ok(btn.hasClass('disabled'), 'btn has disabled class')
start()
}, 0)
})
test("should return reset state", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equals(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading')
equals(btn.html(), 'fat', 'btn text equals fat')
stop()
setTimeout(function () {
ok(btn.attr('disabled'), 'btn is disabled')
ok(btn.hasClass('disabled'), 'btn has disabled class')
start()
stop()
}, 0)
btn.button('reset')
equals(btn.html(), 'mdo', 'btn text equals mdo')
setTimeout(function () {
ok(!btn.attr('disabled'), 'btn is not disabled')
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
start()
}, 0)
})
test("should toggle active", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
ok(!btn.hasClass('active'), 'btn does not have active class')
btn.button('toggle')
ok(btn.hasClass('active'), 'btn has class active')
})
})
\ No newline at end of file
$(function () {
module("bootstrap-collapse")
test("should be defined on jquery object", function () {
ok($(document.body).collapse, 'collapse method is defined')
})
test("should return element", function () {
ok($(document.body).collapse()[0] == document.body, 'document.body returned')
})
test("should show a collapsed element", function () {
var el = $('<div class="collapse"></div>').collapse('show')
ok(el.hasClass('in'), 'has class in')
ok(/height/.test(el.attr('style')), 'has height set')
})
test("should hide a collapsed element", function () {
var el = $('<div class="collapse"></div>').collapse('hide')
ok(!el.hasClass('in'), 'does not have class in')
ok(/height/.test(el.attr('style')), 'has height set')
})
})
\ No newline at end of file
......@@ -13,7 +13,7 @@ $(function () {
test("should add class open to menu if clicked", function () {
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
+ '<ul class="dropdown-menu">'
+ '<li><a href="#">Secondary link</a></li>'
+ '<li><a href="#">Something else here</a></li>'
......@@ -22,16 +22,15 @@ $(function () {
+ '</ul>'
+ '</li>'
+ '</ul>'
, dropdown = $(dropdownHTML).dropdown()
, dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
dropdown.find('.dropdown-toggle').click()
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
})
test("should remove open class if body clicked", function () {
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
+ '<ul class="dropdown-menu">'
+ '<li><a href="#">Secondary link</a></li>'
+ '<li><a href="#">Something else here</a></li>'
......@@ -40,12 +39,14 @@ $(function () {
+ '</ul>'
+ '</li>'
+ '</ul>'
, dropdown = $(dropdownHTML).dropdown().appendTo('#qunit-runoff')
dropdown.find('.dropdown-toggle').click()
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
, dropdown = $(dropdownHTML)
.appendTo('#qunit-fixture')
.find('[data-toggle="dropdown"]')
.dropdown()
.click()
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
$('body').click()
ok(!dropdown.find('.dropdown').hasClass('open'), 'open class removed')
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
dropdown.remove()
})
......
......@@ -10,6 +10,7 @@ $(function () {
test("should return element", function () {
var div = $("<div id='modal-test'></div>")
ok(div.modal() == div, 'document.body returned')
$('#modal-test').remove()
})
test("should expose defaults var for settings", function () {
......@@ -19,32 +20,29 @@ $(function () {
test("should insert into dom when show method is called", function () {
stop()
$.support.transition = false
var div = $("<div id='modal-test'></div>")
div
.modal()
.modal("show")
$("<div id='modal-test'></div>")
.bind("shown", function () {
ok($('#modal-test').length, 'modal insterted into dom')
$(this).remove()
start()
div.remove()
})
.modal("show")
})
test("should hide modal when hide is called", function () {
stop()
$.support.transition = false
var div = $("<div id='modal-test'></div>")
div
.modal()
$("<div id='modal-test'></div>")
.bind("shown", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
div.modal("hide")
$(this).modal("hide")
})
.bind("hidden", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
$('#modal-test').remove()
start()
div.remove()
})
.modal("show")
})
......@@ -54,7 +52,6 @@ $(function () {
$.support.transition = false
var div = $("<div id='modal-test'></div>")
div
.modal()
.bind("shown", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
......@@ -62,18 +59,17 @@ $(function () {
})
.bind("hidden", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
start()
div.remove()
start()
})
.modal("toggle")
})
test("should remove from dom when click .close", function () {
test("should remove from dom when click [data-dismiss=modal]", function () {
stop()
$.support.transition = false
var div = $("<div id='modal-test'><span class='close'></span></div>")
var div = $("<div id='modal-test'><span class='close' data-dismiss='modal'></span></div>")
div
.modal()
.bind("shown", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
......@@ -81,8 +77,8 @@ $(function () {
})
.bind("hidden", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
start()
div.remove()
start()
})
.modal("toggle")
})
......
......@@ -15,14 +15,12 @@ $(function () {
test("should render popover element", function () {
$.support.transition = false
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
.appendTo('#qunit-runoff')
.popover()
.appendTo('#qunit-fixture')
.popover('show')
ok($('.popover').length, 'popover was inserted')
popover.popover('hide')
ok(!$(".popover").length, 'popover removed')
$('#qunit-runoff').empty()
})
test("should store popover instance in popover data object", function () {
......@@ -36,7 +34,7 @@ $(function () {
test("should get title and content from options", function () {
$.support.transition = false
var popover = $('<a href="#">@fat</a>')
.appendTo('#qunit-runoff')
.appendTo('#qunit-fixture')
.popover({
title: function () {
return '@fat'
......@@ -54,13 +52,13 @@ $(function () {
popover.popover('hide')
ok(!$('.popover').length, 'popover was removed')
$('#qunit-runoff').empty()
$('#qunit-fixture').empty()
})
test("should get title and content from attributes", function () {
$.support.transition = false
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
.appendTo('#qunit-runoff')
.appendTo('#qunit-fixture')
.popover()
.popover('show')
......@@ -70,7 +68,7 @@ $(function () {
popover.popover('hide')
ok(!$('.popover').length, 'popover was removed')
$('#qunit-runoff').empty()
$('#qunit-fixture').empty()
})
})
\ No newline at end of file
......@@ -12,7 +12,7 @@ $(function () {
test("should switch active class on scroll", function () {
var sectionHTML = '<div id="masthead"></div>'
, $section = $(sectionHTML).append('#qunit-runoff')
, $section = $(sectionHTML).append('#qunit-fixture')
, topbarHTML ='<div class="topbar">'
+ '<div class="topbar-inner">'
+ '<div class="container">'
......@@ -23,9 +23,9 @@ $(function () {
+ '</div>'
+ '</div>'
+ '</div>'
, $topbar = $(topbarHTML).topbar()
, $topbar = $(topbarHTML).scrollspy()
ok(topbar.find('.active', true)
ok($topbar.find('.active', true))
})
})
\ No newline at end of file
......@@ -3,47 +3,44 @@ $(function () {
module("bootstrap-tabs")
test("should be defined on jquery object", function () {
ok($(document.body).tabs, 'tabs method is defined')
ok($(document.body).tab, 'tabs method is defined')
})
test("should return element", function () {
ok($(document.body).tabs()[0] == document.body, 'document.body returned')
ok($(document.body).tab()[0] == document.body, 'document.body returned')
})
test("should activate element by tab id", function () {
var tabsHTML = '<ul class="tabs">'
+ '<li class="active"><a href="#home">Home</a></li>'
var tabsHTML =
'<ul class="tabs">'
+ '<li><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>'
+ '</ul>'
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
$(tabsHTML).tabs().find('a').last().click()
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
$(tabsHTML).find('li:last a').tab('show')
equals($("#qunit-fixture").find('.active').attr('id'), "profile")
$(tabsHTML).tabs().find('a').first().click()
equals($("#qunit-runoff").find('.active').attr('id'), "home")
$("#qunit-runoff").empty()
$(tabsHTML).find('li:first a').tab('show')
equals($("#qunit-fixture").find('.active').attr('id'), "home")
})
test("should activate element by pill id", function () {
var pillsHTML = '<ul class="pills">'
+ '<li class="active"><a href="#home">Home</a></li>'
test("should activate element by tab id", function () {
var pillsHTML =
'<ul class="pills">'
+ '<li><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>'
+ '</ul>'
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
$(pillsHTML).pills().find('a').last().click()
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
$(pillsHTML).pills().find('a').first().click()
equals($("#qunit-runoff").find('.active').attr('id'), "home")
$(pillsHTML).find('li:last a').tab('show')
equals($("#qunit-fixture").find('.active').attr('id'), "profile")
$("#qunit-runoff").empty()
$(pillsHTML).find('li:first a').tab('show')
equals($("#qunit-fixture").find('.active').attr('id'), "home")
})
})
\ No newline at end of file
$(function () {
module("bootstrap-transition")
test("should be defined on jquery support object", function () {
ok($.support.transition != undefined, 'transition object is defined')
})
test("should provide an end object", function () {
ok($.support.transition.end, 'end string is defined')
})
})
\ No newline at end of file
......@@ -29,53 +29,23 @@ $(function () {
test("should place tooltips relative to placement option", function () {
$.support.transition = false
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>')
.appendTo('#qunit-runoff')
.appendTo('#qunit-fixture')
.twipsy({placement: 'below'})
.twipsy('show')
ok($(".twipsy").hasClass('fade below in'), 'has correct classes applied')
twipsy.twipsy('hide')
ok(!$(".twipsy").length, 'twipsy removed')
$('#qunit-runoff').empty()
})
test("should add a fallback in cases where elements have no title tag", function () {
$.support.transition = false
var twipsy = $('<a href="#" rel="twipsy"></a>')
.appendTo('#qunit-runoff')
.twipsy({fallback: '@fat'})
.twipsy('show')
equals($(".twipsy").text(), "@fat", 'has correct default text')
twipsy.twipsy('hide')
ok(!$(".twipsy").length, 'twipsy removed')
$('#qunit-runoff').empty()
})
test("should not allow html entities", function () {
$.support.transition = false
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
.appendTo('#qunit-runoff')
.twipsy()
.twipsy('show')
ok(!$('.twipsy b').length, 'b tag was not inserted')
twipsy.twipsy('hide')
ok(!$(".twipsy").length, 'twipsy removed')
$('#qunit-runoff').empty()
})
test("should allow html entities if html option set to true", function () {
test("should always allow html entities", function () {
$.support.transition = false
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
.appendTo('#qunit-runoff')
.twipsy({html: true})
.appendTo('#qunit-fixture')
.twipsy('show')
ok($('.twipsy b').length, 'b tag was inserted')
twipsy.twipsy('hide')
ok(!$(".twipsy").length, 'twipsy removed')
$('#qunit-runoff').empty()
})
})
\ No newline at end of file
This diff is collapsed.
......@@ -227,6 +227,6 @@
/** Runoff */
#qunit-runoff {
#qunit-fixture {
display:none;
}
\ No newline at end of file
......@@ -8,10 +8,14 @@
z-index: 1000;
display: none;
padding: 5px;
&.above { margin-top: -5px; }
&.right { margin-left: 5px; }
&.below { margin-top: 5px; }
&.left { margin-left: -5px; }
&.above .arrow { #popoverArrow > .above(); }
&.right .arrow { #popoverArrow > .right(); }
&.below .arrow { #popoverArrow > .below(); }
&.left .arrow { #popoverArrow > .left(); }
&.left .arrow { #popoverArrow > .left(); }
.arrow {
position: absolute;
width: 0;
......
......@@ -9,9 +9,11 @@
padding: 5px;
font-size: 11px;
.opacity(0);
&.in {
.opacity(80);
}
&.in { .opacity(80); }
&.above { margin-top: -2px; }
&.right { margin-left: 2px; }
&.below { margin-top: 2px; }
&.left { margin-left: -2px; }
&.above .twipsy-arrow { #popoverArrow > .above(); }
&.left .twipsy-arrow { #popoverArrow > .left(); }
&.below .twipsy-arrow { #popoverArrow > .below(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment