Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
j3tan committed Feb 1, 2016
1 parent 2b9679d commit da39bfa
Show file tree
Hide file tree
Showing 23 changed files with 256 additions and 200 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v2.1.0 - January 31, 2016

* 2.1.0 (Jeff Tan)
* Add basic element check to DOMEventDelegate (Jeff Tan)
* Allow getModuleConfig() to execute before module instantiation (Jeff Tan)

v2.0.2 - November 18, 2015

* 2.0.2 (Jeff Tan)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ The last published release:

```
<!-- Recommended: Latest version of T3 -->
<script src="https://cdn.rawgit.com/box/t3js/v2.0.2/dist/t3.js"></script>
<script src="https://cdn.rawgit.com/box/t3js/v2.1.0/dist/t3.js"></script>
<!-- Recommended: Latest minified version of T3 -->
<script src="https://cdn.rawgit.com/box/t3js/v2.0.2/dist/t3.min.js"></script>
<script src="https://cdn.rawgit.com/box/t3js/v2.1.0/dist/t3.min.js"></script>
<!-- jQuery version (IE8 + 1.8.0+ jQuery) -->
<script src="https://cdn.rawgit.com/box/t3js/v2.0.2/dist/t3-jquery.js"></script>
<script src="https://cdn.rawgit.com/box/t3js/v2.1.0/dist/t3-jquery.js"></script>
<!-- jQuery minified version (IE8 + 1.8.0+ jQuery) -->
<script src="https://cdn.rawgit.com/box/t3js/v2.0.2/dist/t3-jquery.min.js"></script>
<script src="https://cdn.rawgit.com/box/t3js/v2.1.0/dist/t3-jquery.min.js"></script>
```
## Upgrade from 1.5.1 to 2.0.0

Expand Down
18 changes: 0 additions & 18 deletions dist/t3-jquery-2.0.2.min.js

This file was deleted.

57 changes: 32 additions & 25 deletions dist/t3-jquery-2.0.2.js → dist/t3-jquery-2.1.0.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! t3-jquery v2.0.2 */
/*! t3-jquery v2.1.0 */
/*!
Copyright 2015 Box, Inc. All rights reserved.
Expand Down Expand Up @@ -258,16 +258,19 @@ Box.DOMEventDelegate = (function() {
* @returns {HTMLElement} The matching element or null if not found.
*/
function getNearestTypeElement(element) {
var found = isTypeElement(element);
var found = false;

// We need to check for the existence of 'element' since occasionally we call this on a detached element node.
// For example:
// 1. event handlers like mouseout may sometimes detach nodes from the DOM
// 2. event handlers like mouseleave will still fire on the detached node
// Without checking the existence of a parentNode and returning null, we would throw errors
while (!found && element && !isModuleElement(element)) {
element = element.parentNode;
// Checking existence of element.parentNode ensures the element is a valid HTML Element
while (!found && element && element.parentNode && !isModuleElement(element)) {
found = isTypeElement(element);

if (!found) {
element = element.parentNode;
}
}

return found ? element : null;
Expand Down Expand Up @@ -1105,33 +1108,37 @@ Box.Application = (function() {
*/
getModuleConfig: function(element, name) {

var instanceData = getInstanceDataByElement(element),
configElement;

if (instanceData) {
var instanceData = getInstanceDataByElement(element);
var moduleConfig = null;

if (!instanceData.config) {
// <script type="text/x-config"> is used to store JSON data
configElement = Box.DOM.query(element, 'script[type="text/x-config"]');
if (instanceData && instanceData.config) {
// Check if we've already read the configurations before
moduleConfig = instanceData.config;
} else {
// Read the special script element that stores module configuration in the markup
var configElement = Box.DOM.query(element, 'script[type="text/x-config"]');

// <script> tag supports .text property
if (configElement) {
instanceData.config = JSON.parse(configElement.text);
}
// <script> tag supports .text property
if (configElement) {
moduleConfig = JSON.parse(configElement.text);
}

if (!instanceData.config) {
return null;
} else if (typeof name === 'undefined') {
return instanceData.config;
} else if (name in instanceData.config) {
return instanceData.config[name];
} else {
return null;
// Cache the configurations for performance, if the module instance has been created
if (instanceData) {
instanceData.config = moduleConfig;
}
}

return null;
if (!moduleConfig) {
return null;
} else if (typeof name === 'undefined') {
return moduleConfig;
} else if (name in moduleConfig) {
return moduleConfig[name];
} else {
return null;
}

},

//----------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions dist/t3-jquery-2.1.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit da39bfa

Please sign in to comment.