From ee12ce83057233d271f42162ef3dd2d42d315176 Mon Sep 17 00:00:00 2001 From: Max Kramer Date: Thu, 22 May 2014 18:13:41 -0400 Subject: [PATCH 01/64] Add aria-haspopup and aria-expanded attributes to dropdown plugin 1. Add aria-haspopup="true" and aria-expanded="false" to dropdown docs 2. Toggle aria-expanded between "true" and "false" when opening and closing dropdown Satisfy item 1 from https://github.com/paypal/bootstrap-accessibility-plugin#dropdown. See #13553. --- docs/_includes/js/dropdowns.html | 16 ++++++++-------- js/dropdown.js | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/_includes/js/dropdowns.html b/docs/_includes/js/dropdowns.html index 27b06fe953..2f03bddc14 100644 --- a/docs/_includes/js/dropdowns.html +++ b/docs/_includes/js/dropdowns.html @@ -20,7 +20,7 @@ From d7c92a0f08681e9e0753fcc57a54ddccf4e7e42e Mon Sep 17 00:00:00 2001 From: Bas Bosman Date: Tue, 15 Jul 2014 19:55:28 +0200 Subject: [PATCH 07/64] Fix jsbin link --- docs/_includes/getting-started/browser-device-support.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_includes/getting-started/browser-device-support.html b/docs/_includes/getting-started/browser-device-support.html index 4722bd2c4a..6dde94bdb7 100644 --- a/docs/_includes/getting-started/browser-device-support.html +++ b/docs/_includes/getting-started/browser-device-support.html @@ -188,5 +188,5 @@ $(function () { }) {% endhighlight %} -

Want to see an example? Check out this JS Bin demo.

+

Want to see an example? Check out this JS Bin demo.

From 11db482371ed8195093139ddb4eb31177ada0607 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 15 Jul 2014 16:57:25 -0700 Subject: [PATCH 08/64] popover dismiss-on-next-click example: instead of + Dismissible popover {% highlight html %} - +Dismissible popover {% endhighlight %} -{% highlight js %} -$('.popover-dismiss').popover({ - trigger: 'focus' -}) -{% endhighlight %} - -
-

Multiple-line links

-

Sometimes you want to add a popover to a hyperlink that wraps multiple lines. The default behavior of the popover plugin is to center it horizontally and vertically. Add white-space: nowrap; to your anchors to avoid this.

-

Usage

diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 792fc97790..cfcfa2b503 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -97,9 +97,8 @@ $('.tooltip-test').tooltip() $('.popover-test').popover() - // Default & dismissible popover demos + // Popover demos $('.bs-docs-popover').popover() - $('.bs-docs-popover-dismiss').popover({ trigger: 'focus' }) // Button state demo $('#loading-example-btn').click(function () { From b3d068f2d33e2753421691043ebda63ae7b6f199 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 15 Jul 2014 16:57:40 -0700 Subject: [PATCH 09/64] regenerate docs/assets/js/docs.min.js --- docs/assets/js/docs.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/assets/js/docs.min.js b/docs/assets/js/docs.min.js index f96adab247..7e0cce9bc2 100644 --- a/docs/assets/js/docs.min.js +++ b/docs/assets/js/docs.min.js @@ -21,4 +21,4 @@ var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseI * Licensed under the Creative Commons Attribution 3.0 Unported License. For * details, see http://creativecommons.org/licenses/by/3.0/. */ -!function(a){"use strict";a(function(){var b=a(window),c=a(document.body);c.scrollspy({target:".bs-docs-sidebar"}),b.on("load",function(){c.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),function(){var b=a("#bs-theme-stylesheet"),c=a(".bs-docs-theme-toggle"),d=function(){b.attr("href",b.attr("data-href")),c.text("Disable theme preview"),localStorage.setItem("previewTheme",!0)};localStorage.getItem("previewTheme")&&d(),c.click(function(){var a=b.attr("href");a&&0!==a.indexOf("data")?(b.attr("href",""),c.text("Preview theme"),localStorage.removeItem("previewTheme")):d()})}(),a(".tooltip-demo").tooltip({selector:'[data-toggle="tooltip"]',container:"body"}),a(".popover-demo").popover({selector:'[data-toggle="popover"]',container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-popover").popover(),a(".bs-docs-popover-dismiss").popover({trigger:"focus"}),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)}),ZeroClipboard.config({moviePath:"/assets/flash/ZeroClipboard.swf",hoverClass:"btn-clipboard-hover"}),a(".highlight").each(function(){var b=a(this),c=b.prev(),d='
Copy
';c.hasClass("bs-example")?c.before(d.replace(/btn-clipboard/,"btn-clipboard with-example")):b.before(d)});var d=new ZeroClipboard(a(".btn-clipboard")),e=a("#global-zeroclipboard-html-bridge");d.on("load",function(){e.data("placement","top").attr("title","Copy to clipboard").tooltip()}),d.on("dataRequested",function(b){var c=a(this).parent().nextAll(".highlight").first();b.setText(c.text())}),d.on("complete",function(){e.attr("title","Copied!").tooltip("fixTitle").tooltip("show").attr("title","Copy to clipboard").tooltip("fixTitle")}),d.on("noflash wrongflash",function(){e.attr("title","Flash required").tooltip("fixTitle").tooltip("show")})})}(jQuery); \ No newline at end of file +!function(a){"use strict";a(function(){var b=a(window),c=a(document.body);c.scrollspy({target:".bs-docs-sidebar"}),b.on("load",function(){c.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),function(){var b=a("#bs-theme-stylesheet"),c=a(".bs-docs-theme-toggle"),d=function(){b.attr("href",b.attr("data-href")),c.text("Disable theme preview"),localStorage.setItem("previewTheme",!0)};localStorage.getItem("previewTheme")&&d(),c.click(function(){var a=b.attr("href");a&&0!==a.indexOf("data")?(b.attr("href",""),c.text("Preview theme"),localStorage.removeItem("previewTheme")):d()})}(),a(".tooltip-demo").tooltip({selector:'[data-toggle="tooltip"]',container:"body"}),a(".popover-demo").popover({selector:'[data-toggle="popover"]',container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-popover").popover(),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)}),ZeroClipboard.config({moviePath:"/assets/flash/ZeroClipboard.swf",hoverClass:"btn-clipboard-hover"}),a(".highlight").each(function(){var b=a(this),c=b.prev(),d='
Copy
';c.hasClass("bs-example")?c.before(d.replace(/btn-clipboard/,"btn-clipboard with-example")):b.before(d)});var d=new ZeroClipboard(a(".btn-clipboard")),e=a("#global-zeroclipboard-html-bridge");d.on("load",function(){e.data("placement","top").attr("title","Copy to clipboard").tooltip()}),d.on("dataRequested",function(b){var c=a(this).parent().nextAll(".highlight").first();b.setText(c.text())}),d.on("complete",function(){e.attr("title","Copied!").tooltip("fixTitle").tooltip("show").attr("title","Copy to clipboard").tooltip("fixTitle")}),d.on("noflash wrongflash",function(){e.attr("title","Flash required").tooltip("fixTitle").tooltip("show")})})}(jQuery); \ No newline at end of file From cc7fab893d2e3c24fdc0e26fd47478cc0006200b Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Wed, 16 Jul 2014 08:44:56 +0200 Subject: [PATCH 10/64] Follow-up to #13907: simplify JS logic for focus shim --- js/button.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/js/button.js b/js/button.js index 7e2a6e4e88..b3e944c591 100644 --- a/js/button.js +++ b/js/button.js @@ -97,15 +97,6 @@ } - // FOCUS SHIM (FOR BUTTON GROUPS) - // ============================== - - function getBtnTarget(target) { - var $target = $(target) - return $target.hasClass('btn') ? $target : $target.parent('.btn') - } - - // BUTTON DATA-API // =============== @@ -116,11 +107,8 @@ Plugin.call($btn, 'toggle') e.preventDefault() }) - .on('focus.bs.button.data-api', '[data-toggle^="button"]', function (e) { - getBtnTarget(e.target).addClass('focus') - }) - .on('blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - getBtnTarget(e.target).removeClass('focus') + .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { + $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus') }) }(jQuery); From f9349f36dfbfda7bf755f458d856d45d07745f29 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 17 Jul 2014 03:53:49 +0200 Subject: [PATCH 11/64] Clean up Affix documentation --- docs/_includes/js/affix.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/_includes/js/affix.html b/docs/_includes/js/affix.html index 4ce51cb34b..56168d6a89 100644 --- a/docs/_includes/js/affix.html +++ b/docs/_includes/js/affix.html @@ -14,8 +14,8 @@

Here's how the affix plugin works:

  1. To start, the plugin adds .affix-top to indicate the element is in its top-most position. At this point no CSS positioning is required.
  2. -
  3. Scrolling past the element you want affixed should trigger the actual affixing. This is where .affix replaces .affix-top and sets position: fixed; (provided by Bootstrap's code CSS).
  4. -
  5. If a bottom offset is defined, scrolling past that should replace .affix with .affix-bottom. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add position: absolute; when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.
  6. +
  7. Scrolling past the element you want affixed should trigger the actual affixing. This is where .affix replaces .affix-top and sets position: fixed; (provided by Bootstrap's CSS).
  8. +
  9. If a bottom offset is defined, scrolling past it should replace .affix with .affix-bottom. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add position: absolute; when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.

Follow the above steps to set your CSS for either of the usage options below.

@@ -31,14 +31,14 @@

Via JavaScript

Call the affix plugin via JavaScript:

{% highlight js %} - $('#my-affix').affix({ - offset: { - top: 100 - , bottom: function () { - return (this.bottom = $('.footer').outerHeight(true)) - } +$('#myAffix').affix({ + offset: { + top: 100, + bottom: function () { + return (this.bottom = $('.footer').outerHeight(true)) } - }) + } +}) {% endhighlight %} @@ -75,7 +75,7 @@

Events

-

Bootstrap's affix class exposes a few events for hooking into affix functionality.

+

Bootstrap's affix plugin exposes a few events for hooking into affix functionality.

From 31772677f959bf449fee2a57805da66476d8eec8 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 17 Jul 2014 04:11:21 +0200 Subject: [PATCH 12/64] Clean up the Alert documentation --- docs/_includes/js/alerts.html | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/_includes/js/alerts.html b/docs/_includes/js/alerts.html index e9cb8c871b..5b7f4e10c3 100644 --- a/docs/_includes/js/alerts.html +++ b/docs/_includes/js/alerts.html @@ -24,21 +24,25 @@

Usage

-

Enable dismissal of an alert via JavaScript:

- {% highlight js %}$(".alert").alert(){% endhighlight %} -

Markup

Just add data-dismiss="alert" to your close button to automatically give an alert close functionality.

- {% highlight html %}{% endhighlight %} + +{% highlight html %} + +{% endhighlight %} + +

To have your alerts use animation when closing, make sure they have the .fade and .in class already applied to them.

Methods

$().alert()

-

Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the .fade and .in class already applied to them.

+

Makes an alert listen for click events on descendant elements which have the data-dismiss="alert" attribute. (Not necessary when using the data-api's auto-initialization.)

-

.alert('close')

+

$().alert('close')

Closes an alert.

- {% highlight js %}$(".alert").alert('close'){% endhighlight %}

Events

@@ -64,7 +68,7 @@
{% highlight js %} -$('#my-alert').on('closed.bs.alert', function () { +$('#myAlert').on('closed.bs.alert', function () { // do something… }) {% endhighlight %} From 38335b2a3dcaac8bb706b5542e10f8edd8ea6a5e Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 17 Jul 2014 04:33:30 +0200 Subject: [PATCH 13/64] Merge alert examples and add `.bs-example-standalone` class --- docs/_includes/js/alerts.html | 4 +--- docs/assets/css/src/docs.css | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/_includes/js/alerts.html b/docs/_includes/js/alerts.html index 5b7f4e10c3..2f6b33368a 100644 --- a/docs/_includes/js/alerts.html +++ b/docs/_includes/js/alerts.html @@ -3,14 +3,12 @@

Example alerts

Add dismiss functionality to all alert messages with this plugin.

-
+
-
-