Skip to content

Commit

Permalink
Added exports to module to support for require with browserify.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjb committed Jun 9, 2016
1 parent 7e209dd commit 3857dd6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
12 changes: 10 additions & 2 deletions build/content-select.js

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

4 changes: 2 additions & 2 deletions build/content-select.min.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ContentSelect",
"description": "A JavaScript library providing cross-browser support for content selection.",
"version": "1.0.2",
"version": "1.0.3",
"author": {
"name": "Anthony Blackshaw",
"email": "ant@getme.co.uk",
Expand Down
15 changes: 13 additions & 2 deletions src/content-select.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.ContentSelect = {}
ContentSelect = {}

class ContentSelect.Range

Expand Down Expand Up @@ -363,4 +363,15 @@ _getNodeRange = (element, docRange) ->

endOffset = childNode.textContent.length + 1

return [startNode, startOffset, endNode, endOffset]
return [startNode, startOffset, endNode, endOffset]


# Export the namespace

# Browser (via window)
if typeof window != 'undefined'
window.ContentSelect = ContentSelect

# Node/Browserify
if typeof module != 'undefined' and module.exports
exports = module.exports = ContentSelect

0 comments on commit 3857dd6

Please sign in to comment.