Permalink
Browse files

Removing Screw.Status.require_using_eval because its unused. Removed …

…Screw.global_suite_added because checking Screw.root_element is sufficient.
  • Loading branch information...
1 parent 2612008 commit 63419232a695b2a7678d6bd1a784f4eb82fa6fa1 @btakita btakita committed Apr 29, 2008
Showing with 12 additions and 36 deletions.
  1. +2 −22 lib/screw.assets.js
  2. +10 −14 lib/screw.builder.js
View
24 lib/screw.assets.js
@@ -5,41 +5,21 @@
var included_stylesheets = {};
var cache_buster = parseInt(new Date().getTime()/(1*1000));
- var base_require = function(javascript_path, onload, inject_js) {
+ Screw.Assets.require = function(javascript_path, onload) {
if(!required_paths[javascript_path]) {
var full_path = javascript_path + ".js";
if (Screw.Assets.use_cache_buster) {
full_path += '?' + cache_buster;
}
- inject_js(full_path);
+ document.write("<script src='" + full_path + "' type='text/javascript'></script>");
if(onload) {
var scripts = document.getElementsByTagName('script');
scripts[scripts.length-1].onload = onload;
}
required_paths[javascript_path] = true;
}
- }
-
- Screw.Assets.require = function(javascript_path, onload) {
- base_require(javascript_path, onload, function(full_path) {
- document.write("<script src='" + full_path + "' type='text/javascript'></script>");
- });
};
- Screw.Assets.require_using_eval = function(javascript_path, onload) {
- base_require(javascript_path, onload, function(full_path) {
- $.ajax({
- type: "GET",
- url: full_path,
- dataType: "script",
- async: false,
- success: function(js) {
- eval(js);
- }
- });
- });
- }
-
Screw.Assets.stylesheet = function(stylesheet_path) {
if(!included_stylesheets[stylesheet_path]) {
var full_path = stylesheet_path + ".css";
View
24 lib/screw.builder.js
@@ -5,18 +5,15 @@ var Screw = {
"with (specifications) { with (matchers) { " + contents + " } }"
);
- if(!Screw.global_suite_added) {
- $(function() {
- Screw.root_element = $('<div class="describe">');
- Screw.root_element
- .append($('<h3 class="status">'))
- .append('<ol class="befores">')
- .append('<ul class="its">')
- .append('<ul class="describes">')
- .append('<ol class="afters">')
- Screw.Specifications.context.push(Screw.root_element);
- })
- Screw.global_suite_added = true
+ if(!Screw.root_element) {
+ Screw.root_element = $('<div class="describe">');
+ Screw.root_element
+ .append($('<h3 class="status">'))
+ .append('<ol class="befores">')
+ .append('<ul class="its">')
+ .append('<ul class="describes">')
+ .append('<ol class="afters">')
+ Screw.Specifications.context.push(Screw.root_element);
}
Screw.last_suite = suite;
@@ -28,8 +25,7 @@ var Screw = {
}
})
},
- root_element: false,
- global_suite_added: false,
+ root_element: null,
last_suite: null,
Specifications: {
context: [],

0 comments on commit 6341923

Please sign in to comment.