Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD (simple) #59

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source/Slick.Finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,4 +980,14 @@ Slick.uidOf = function(node){

if (!this.Slick) this.Slick = Slick;

// AMD

if (typeof define == 'function' && define.amd){
define(['./Slick.Parser'], function(parse){
Slick.parse = parse;
return Slick;
});
}


}).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
13 changes: 10 additions & 3 deletions Source/Slick.Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steve
});
};

var regexp = new RegExp(
var regexp = RegExp(
/*
#!/usr/bin/env ruby
puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
Expand Down Expand Up @@ -215,7 +215,14 @@ function parser(
return '';
};

// Slick NS
// AMD

if (typeof define == 'function' && define.amd){
define(function(){return parse});
return;
}

// exports

var Slick = (this.Slick || {});

Expand All @@ -227,4 +234,4 @@ Slick.escapeRegExp = escapeRegExp;

if (!this.Slick) this.Slick = Slick;

}).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
}).apply(/*<CommonJS>*/(typeof exports == 'object') ? exports : /*</CommonJS>*/this);
10 changes: 10 additions & 0 deletions attr.amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*jshint asi:true, laxbreak:true*/
define(['./Source/Slick.Finder'], function(Slick){
return {
has: Slick.hasAttribute,
get: Slick.getAttribute,

define: Slick.defineAttributeGetter,
lookup: Slick.lookupAttributeGetter
}
})
21 changes: 21 additions & 0 deletions finder.amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*jshint asi:true, laxbreak:true*/
define(['./Source/Slick.Finder', './attr.amd'], function(Slick, attr){
return {

isXML: Slick.isXML,
contains: Slick.contains,

find: Slick.find,
search: Slick.search,
match: Slick.match,

override: Slick.override,

attr: attr,

pseudo:{
define: Slick.definePseudo,
lookup: Slick.lookupPseudo
}
}
})
6 changes: 6 additions & 0 deletions parser.amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*jshint asi:true, laxbreak:true*/
define(['./Source/Slick.Parser'], function(parse){
return {
parse: parse
}
})
6 changes: 6 additions & 0 deletions uid.amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*jshint asi:true, laxbreak:true*/
define(['./Source/Slick.Finder'], function(Slick){
return {
uidOf: Slick.uidOf
}
})