http://trac.tiddlywiki.org/changeset/9771
JeremyRuston
2009-05-26 09:45:33 +0000 (Tue, 26 May 2009)
53
Renamed jQuery plugins to "twFile" and "twStylesheet"
---------------
U Trunk/core/deprecated/Dom.js
U Trunk/core/deprecated/FileSystem.js
D Trunk/core/jquery/plugins/jquery.file.js
D Trunk/core/jquery/plugins/jquery.stylesheet.js
A Trunk/core/jquery/plugins/jquery.twFile.js
A Trunk/core/jquery/plugins/jquery.twStylesheet.js
U Trunk/core/jquery/plugins/split.recipe
D Trunk/core/jquery/plugins/test/jquery.file.html
D Trunk/core/jquery/plugins/test/jquery.stylesheet.html
A Trunk/core/jquery/plugins/test/jquery.twFile.html
A Trunk/core/jquery/plugins/test/jquery.twStylesheet.html
D Trunk/core/jquery/plugins/test/js/jquery.file.js
D Trunk/core/jquery/plugins/test/js/jquery.stylesheet.js
A Trunk/core/jquery/plugins/test/js/jquery.twFile.js
A Trunk/core/jquery/plugins/test/js/jquery.twStylesheet.js
---------------
Modified: Trunk/core/deprecated/Dom.js
===================================================================
--- Trunk/core/deprecated/Dom.js 2009-05-25 20:37:00 UTC (rev 9770)
+++ Trunk/core/deprecated/Dom.js 2009-05-26 09:45:33 UTC (rev 9771)
@@ -5,11 +5,11 @@
// @Deprecated: Use jQuery.stylesheet instead
function setStylesheet(s,id,doc)
{
- jQuery.stylesheet(s,{ id: id, doc: doc });
+ jQuery.twStylesheet(s,{ id: id, doc: doc });
}
// @Deprecated: Use jQuery.stylesheet.remove instead
function removeStyleSheet(id)
{
- jQuery.stylesheet.remove({ id: id });
+ jQuery.twStylesheet.remove({ id: id });
}
Modified: Trunk/core/deprecated/FileSystem.js
===================================================================
--- Trunk/core/deprecated/FileSystem.js 2009-05-25 20:37:00 UTC (rev 9770)
+++ Trunk/core/deprecated/FileSystem.js 2009-05-26 09:45:33 UTC (rev 9771)
@@ -5,16 +5,16 @@
function saveFile(filePath,content)
{
- return jQuery.file.save(filePath,content);
+ return jQuery.twFile.save(filePath,content);
}
function loadFile(filePath)
{
- return jQuery.file.load(filePath);
+ return jQuery.twFile.load(filePath);
}
function copyFile(dest,source)
{
- return jQuery.file.copy(dest,source);
+ return jQuery.twFile.copy(dest,source);
}
Deleted: Trunk/core/jquery/plugins/jquery.file.js
Deleted: Trunk/core/jquery/plugins/jquery.stylesheet.js
Copied: Trunk/core/jquery/plugins/jquery.twFile.js (from rev 9770,
Trunk/core/jquery/plugins/jquery.file.js)
===================================================================
--- Trunk/core/jquery/plugins/jquery.twFile.js (rev 0)
+++ Trunk/core/jquery/plugins/jquery.twFile.js 2009-05-26 09:45:33 UTC (rev
9771)
@@ -0,0 +1,273 @@
+/*
+jquery.twFile.js
+
+jQuery plugin for loading a file and saving data to a file
+
+Copyright (c) UnaMesa Association 2009
+
+Triple licensed under the BSD, MIT and GPL licenses:
+ http://www.opensource.org/licenses/bsd-license.php
+ http://www.opensource.org/licenses/mit-license.php
+ http://www.gnu.org/licenses/gpl.html
+*/
+
+(function($) {
+ if(!$.twFile) {
+ $.twFile = {};
+ }
+
+ $.extend($.twFile,{
+ currentDriver: null,
+ driverList: ["activeX", "mozilla", "tiddlySaver",
"javaLiveConnect"],
+
+ getDriver: function() {
+ if(this.currentDriver === null) {
+ for(var t=0; t<this.driverList.length; t++) {
+ if(this.currentDriver === null &&
drivers[this.driverList[t]].isAvailable &&
drivers[this.driverList[t]].isAvailable())
+ this.currentDriver =
drivers[this.driverList[t]];
+ }
+ }
+ return this.currentDriver;
+ },
+ init: function() {
+ this.getDriver();
+ },
+ load: function(filePath) {
+ return this.getDriver().loadFile(filePath);
+ },
+ save: function(filePath,content) {
+ return this.getDriver().saveFile(filePath,content);
+ },
+ copy: function(dest,source) {
+ if(this.getDriver().copyFile)
+ return this.currentDriver.copyFile(dest,source);
+ else
+ return false;
+ }
+ });
+
+ // Deferred initialisation for any drivers that need it
+ $(function() {
+ for(var t in drivers) {
+ if(drivers[t].deferredInit)
+ drivers[t].deferredInit();
+ }
+ });
+
+ // Private driver implementations for each browser
+
+ var drivers = {};
+
+ // Internet Explorer driver
+
+ drivers.activeX = {
+ name: "activeX",
+ isAvailable: function() {
+ try {
+ var fso = new
ActiveXObject("Scripting.FileSystemObject");
+ } catch(ex) {
+ return false;
+ }
+ return true;
+ },
+ loadFile: function(filePath) {
+ // Returns null if it can't do it, false if there's an
error, or a string of the content if successful
+ try {
+ var fso = new
ActiveXObject("Scripting.FileSystemObject");
+ var file = fso.OpenTextFile(filePath,1);
+ var content = file.ReadAll();
+ file.Close();
+ } catch(ex) {
+ //# alert("Exception while attempting to
load\n\n" + ex.toString());
+ return null;
+ }
+ return content;
+ },
+ createPath: function(path) {
+ //# Remove the filename, if present. Use trailing slash
(i.e. "foo\bar\") if no filename.
+ var pos = path.lastIndexOf("\\");
+ if(pos!=-1)
+ path = path.substring(0,pos+1);
+ //# Walk up the path until we find a folder that exists
+ var scan = [path];
+ try {
+ var fso = new
ActiveXObject("Scripting.FileSystemObject");
+ var parent = fso.GetParentFolderName(path);
+ while(parent && !fso.FolderExists(parent)) {
+ scan.push(parent);
+ parent =
fso.GetParentFolderName(parent);
+ }
+ //# Walk back down the path, creating folders
+ for(i=scan.length-1;i>=0;i--) {
+ if(!fso.FolderExists(scan[i])) {
+ fso.CreateFolder(scan[i]);
+ }
+ }
+ return true;
+ } catch(ex) {
+ }
+ return false;
+ },
+ copyFile: function(dest,source) {
+ drivers.activeX.createPath(dest);
+ try {
+ var fso = new
ActiveXObject("Scripting.FileSystemObject");
+ fso.GetFile(source).Copy(dest);
+ } catch(ex) {
+ return false;
+ }
+ return true;
+ },
+ saveFile: function(filePath,content) {
+ // Returns null if it can't do it, false if there's an
error, true if it saved OK
+ drivers.activeX.createPath(filePath);
+ try {
+ var fso = new
ActiveXObject("Scripting.FileSystemObject");
+ var file = fso.OpenTextFile(filePath,2,-1,0);
+ file.Write(content);
+ file.Close();
+ } catch (ex) {
+ return null;
+ }
+ return true;
+ }
+ };
+
+ // Mozilla driver
+
+ drivers.mozilla = {
+ name: "mozilla",
+ isAvailable: function() {
+ return !!window.Components;
+ },
+ loadFile: function(filePath) {
+ // Returns null if it can't do it, false if there's an
error, or a string of the content if successful
+ if(window.Components) {
+ try {
+
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+ file.initWithPath(filePath);
+ if(!file.exists())
+ return null;
+ var inputStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
+ inputStream.init(file,0x01,4,null);
+ var converter =
Components.classes["@mozilla.org/intl/converter-input-stream;1"].createInstance(Components.interfaces.nsIConverterInputStream);
+ converter.init(inputStream, "UTF-8", 0,
0);
+ var buffer = {};
+ var result = [];
+ while(converter.readString(-1,buffer)
!= 0) {
+ result.push(buffer.value);
+ }
+ converter.close();
+ inputStream.close();
+ return result.join("");
+ } catch(ex) {
+ //# alert("Exception while attempting
to load\n\n" + ex);
+ return false;
+ }
+ }
+ return null;
+ },
+ saveFile: function(filePath,content) {
+ // Returns null if it can't do it, false if there's an
error, true if it saved OK
+ if(window.Components) {
+ try {
+
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+ file.initWithPath(filePath);
+ if(!file.exists())
+ file.create(0,0664);
+ var out =
Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
+ out.init(file,0x22,4,null);
+ var converter =
Components.classes["@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream);
+ converter.init(out, "UTF-8", 0, 0);
+ converter.writeString(content);
+ converter.close();
+ out.close();
+ return true;
+ } catch(ex) {
+ alert("Exception while attempting to
save\n\n" + ex);
+ return false;
+ }
+ }
+ return null;
+ }
+ };
+
+ // TiddlySaver driver
+
+ drivers.tiddlySaver = {
+ name: "tiddlySaver",
+ deferredInit: function() {
+ if(!document.applets["TiddlySaver"] &&
!$.browser.mozilla && !$.browser.msie) {
+ $(document.body).append("<applet
style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class'
archive='TiddlySaver.jar' width='1'height='1'></applet>");
+ }
+ },
+ isAvailable: function() {
+ return !!document.applets["TiddlySaver"];
+ },
+ loadFile: function(filePath) {
+ var r;
+ try {
+ if(document.applets["TiddlySaver"]) {
+ r =
document.applets["TiddlySaver"].loadFile(javaUrlToFilename(filePath),"UTF-8");
+ return (r === undefined || r === null)
? null : String(r);
+ }
+ } catch(ex) {
+ }
+ return null;
+ },
+ saveFile: function(filePath,content) {
+ try {
+ if(document.applets["TiddlySaver"])
+ return
document.applets["TiddlySaver"].saveFile(javaUrlToFilename(filePath),"UTF-8",content);
+ } catch(ex) {
+ }
+ return null;
+ }
+ }
+
+ // Java LiveConnect driver
+
+ drivers.javaLiveConnect = {
+ name: "javaLiveConnect",
+ isAvailable: function() {
+ return !!window.java && !!window.java.io &&
!!window.java.io.FileReader;
+ },
+ loadFile: function(filePath) {
+ var r;
+ var content = [];
+ try {
+ r = new java.io.BufferedReader(new
java.io.FileReader(javaUrlToFilename(filePath)));
+ var line;
+ while((line = r.readLine()) != null)
+ content.push(new String(line));
+ r.close();
+ } catch(ex) {
+ return null;
+ }
+ return content.join("\n") + "\n";
+ },
+ saveFile: function(filePath,content) {
+ try {
+ var s = new java.io.PrintStream(new
java.io.FileOutputStream(javaUrlToFilename(filePath)));
+ s.print(content);
+ s.close();
+ } catch(ex) {
+ return null;
+ }
+ return true;
+ }
+ }
+
+ // Private utilities
+
+ function javaUrlToFilename(url) {
+ var f = "//localhost";
+ if(url.indexOf(f) == 0)
+ return url.substring(f.length);
+ var i = url.indexOf(":");
+ return i > 0 ? url.substring(i-1) : url;
+ }
+
+})(jQuery);
Copied: Trunk/core/jquery/plugins/jquery.twStylesheet.js (from rev 9770,
Trunk/core/jquery/plugins/jquery.stylesheet.js)
===================================================================
--- Trunk/core/jquery/plugins/jquery.twStylesheet.js
(rev 0)
+++ Trunk/core/jquery/plugins/jquery.twStylesheet.js 2009-05-26 09:45:33 UTC
(rev 9771)
@@ -0,0 +1,64 @@
+/*
+jquery.twStylesheet.js
+
+jQuery plugin to dynamically insert CSS rules into a document
+
+Usage:
+ jQuery.twStylesheet applies style definitions
+ jQuery.twStylesheet.remove neutralizes style definitions
+
+Copyright (c) UnaMesa Association 2009
+
+Triple licensed under the BSD, MIT and GPL licenses:
+ http://www.opensource.org/licenses/bsd-license.php
+ http://www.opensource.org/licenses/mit-license.php
+ http://www.gnu.org/licenses/gpl.html
+*/
+
+(function($) {
+
+var defaultId = "customStyleSheet"; // XXX: rename to dynamicStyleSheet?
+
+// Add or replace a style sheet
+// css argument is a string of CSS rule sets
+// options.id is an optional name identifying the style sheet
+// options.doc is an optional document reference
+// N.B.: Uses DOM methods instead of jQuery to ensure cross-browser
comaptibility.
+$.twStylesheet = function(css, options) {
+ options = options || {};
+ var id = options.id || defaultId;
+ var doc = options.doc || document;
+ var el = doc.getElementById(id);
+ if(doc.createStyleSheet) { // IE-specific handling
+ if(el) {
+ el.parentNode.removeChild(el);
+ }
+
doc.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd",
+ " <style id='" + id + "'>" + css + "</style>"); //
fails without
+ } else { // modern browsers
+ if(el) {
+ el.replaceChild(doc.createTextNode(css), el.firstChild);
+ } else {
+ el = doc.createElement("style");
+ el.type = "text/css";
+ el.id = id;
+ el.appendChild(doc.createTextNode(css));
+ doc.getElementsByTagName("head")[0].appendChild(el);
+ }
+ }
+};
+
+// Remove existing style sheet
+// options.id is an optional name identifying the style sheet
+// options.doc is an optional document reference
+$.twStylesheet.remove = function(options) {
+ options = options || {};
+ var id = options.id || defaultId;
+ var doc = options.doc || document;
+ var el = doc.getElementById(id);
+ if(el) {
+ el.parentNode.removeChild(el);
+ }
+};
+
+})(jQuery);
Modified: Trunk/core/jquery/plugins/split.recipe
===================================================================
--- Trunk/core/jquery/plugins/split.recipe 2009-05-25 20:37:00 UTC (rev
9770)
+++ Trunk/core/jquery/plugins/split.recipe 2009-05-26 09:45:33 UTC (rev
9771)
@@ -1,3 +1,3 @@
jquery: jquery.encoding.digests.sha1.js
-jquery: jquery.file.js
-jquery: jquery.stylesheet.js
+jquery: jquery.twFile.js
+jquery: jquery.twStylesheet.js
Deleted: Trunk/core/jquery/plugins/test/jquery.file.html
Deleted: Trunk/core/jquery/plugins/test/jquery.stylesheet.html
Copied: Trunk/core/jquery/plugins/test/jquery.twFile.html (from rev 9770,
Trunk/core/jquery/plugins/test/jquery.file.html)
===================================================================
--- Trunk/core/jquery/plugins/test/jquery.twFile.html
(rev 0)
+++ Trunk/core/jquery/plugins/test/jquery.twFile.html 2009-05-26 09:45:33 UTC
(rev 9771)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Tests</title>
+ <link rel="stylesheet" type="text/css"
href="../../../test/qunit/testsuite.css">
+ <script src="../../jquery-1.3.2.min.js" type="text/javascript"></script>
+ <!-- test suite -->
+ <script src="../../../test/qunit/testrunner.js"
type="text/javascript"></script>
+ <script src="../../../test/qunit/raiseAssertion.js"
type="text/javascript"></script>
+ <!-- plugin -->
+ <script src="../jquery.twFile.js" type="text/javascript"></script>
+ <!-- test code -->
+ <script src="js/jquery.twFile.js" type="text/javascript"></script>
+</head>
+
+<body>
+ <h2 id="banner"></h2>
+ <h2 id="userAgent"></h2>
+ <ol id="tests"></ol>
+ <div id="main"></div>
+</body>
+
+</html>
Copied: Trunk/core/jquery/plugins/test/jquery.twStylesheet.html (from rev 9770,
Trunk/core/jquery/plugins/test/jquery.stylesheet.html)
===================================================================
--- Trunk/core/jquery/plugins/test/jquery.twStylesheet.html
(rev 0)
+++ Trunk/core/jquery/plugins/test/jquery.twStylesheet.html 2009-05-26
09:45:33 UTC (rev 9771)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Tests</title>
+ <link rel="stylesheet" type="text/css"
href="../../../test/qunit/testsuite.css">
+ <script src="../../jquery-1.3.2.min.js" type="text/javascript"></script>
+ <!-- test suite -->
+ <script src="../../../test/qunit/testrunner.js"
type="text/javascript"></script>
+ <script src="../../../test/qunit/raiseAssertion.js"
type="text/javascript"></script>
+ <!-- plugin -->
+ <script src="../jquery.twStylesheet.js" type="text/javascript"></script>
+ <!-- test code -->
+ <script src="js/jquery.twStylesheet.js" type="text/javascript"></script>
+</head>
+
+<body>
+ <h2 id="banner"></h2>
+ <h2 id="userAgent"></h2>
+ <ol id="tests"></ol>
+ <div id="main"></div>
+</body>
+
+</html>
Deleted: Trunk/core/jquery/plugins/test/js/jquery.file.js
Deleted: Trunk/core/jquery/plugins/test/js/jquery.stylesheet.js
Copied: Trunk/core/jquery/plugins/test/js/jquery.twFile.js (from rev 9770,
Trunk/core/jquery/plugins/test/js/jquery.file.js)
===================================================================
--- Trunk/core/jquery/plugins/test/js/jquery.twFile.js
(rev 0)
+++ Trunk/core/jquery/plugins/test/js/jquery.twFile.js 2009-05-26 09:45:33 UTC
(rev 9771)
@@ -0,0 +1,87 @@
+jQuery(document).ready(function() {
+ module("jquery.twFile");
+
+ test("load", function() {
+ var actual, expected, filepath;
+
+ actual = jQuery.twFile.load();
+ expected = null;
+ same(actual, expected, "returns null if no argument is
specified");
+
+ filepath = getDocumentPath() + "/sample.txt";
+ actual = jQuery.twFile.load(filepath);
+ expected = "lorem ipsum\n" +
+ "dolor sit amet\n" +
+ "\n" +
+ "
!\"#$%&'()*+,-./0123456789:;<=>?...@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n"
+
+ "\xa9\u010d\u010c\n" +
+ "foo bar baz\n";
+ same(actual, expected, "returns contents of specified file");
+
+ filepath = "/null";
+ actual = jQuery.twFile.load(filepath);
+ expected = null;
+ same(actual, expected, "returns null if the specified file does
not exist");
+
+ filepath = "sample.txt";
+ actual = jQuery.twFile.load(filepath);
+ expected = null;
+ same(actual, expected, "returns null if specified file path is
not absolute");
+ });
+
+ test("save", function() {
+ var actual, expression, expected, str;
+ var filepath = getDocumentPath() + "/savetest.txt";
+
+ /* disabled as browser-level exceptions cannot be trapped
+ expression = function() { jQuery.twFile.save(); };
+ expected = "ReferenceError";
+ raises(expression, expected, "raises exception if no argument
is specified");
+ */
+
+ /* disabled as browser-level exceptions cannot be trapped
+ expression = function() { jQuery.twFile.save(filepath); };
+ expected = "TypeError";
+ raises(expression, expected, "raises exception if no content
argument is specified");
+ */
+
+ /* disabled as browser-level exceptions cannot be trapped
+ expression = function() { jQuery.twFile.save("foo.txt", "sample
content"); };
+ expected = "ReferenceError";
+ raises(expression, expected, "raises exception if specified
file path is not absolute");
+ */
+
+ str = "lorem ipsum\n" +
+ "dolor sit amet\n" +
+ "\n" +
+ "
!\"#$%&'()*+,-./0123456789:;<=>?...@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n"
+
+ "\xa9\u010d\u010c\n" +
+ "foo bar baz\n" +
+ (new Date).toString();
+ saveAndLoadString(filepath, str, "writes given ANSI text
content to specified file");
+
+ //str = "\xa9\u010d\u010c";
+ //saveAndLoadString(filepath, str, "writes given UTF-8 text
content to specified file");
+
+ //jQuery.twFile.save(filepath, ""); // teardown: blank file
contents (deletion impossible)
+ });
+
+ // helper function to save and load back a string to a file
+ var saveAndLoadString = function(filepath,str,desc) {
+ jQuery.twFile.save(filepath, str);
+ var actual = jQuery.twFile.load(filepath);
+ same(actual, str, desc);
+ }
+
+ // helper function to retrieve current document's file path
+ var getDocumentPath = function() {
+ var path = document.location.pathname;
+ var startpos = 0;
+ var endpos = path.lastIndexOf("/");
+ if(path.charAt(2) == ":") {
+ startpos = 1;
+ path = path.replace(new RegExp("/","g"),"\\")
+ }
+ return unescape(path.substring(startpos, endpos));
+ };
+});
Copied: Trunk/core/jquery/plugins/test/js/jquery.twStylesheet.js (from rev
9770, Trunk/core/jquery/plugins/test/js/jquery.stylesheet.js)
===================================================================
--- Trunk/core/jquery/plugins/test/js/jquery.twStylesheet.js
(rev 0)
+++ Trunk/core/jquery/plugins/test/js/jquery.twStylesheet.js 2009-05-26
09:45:33 UTC (rev 9771)
@@ -0,0 +1,69 @@
+jQuery(document).ready(function() {
+ module("jquery.twStylesheet");
+
+ test("apply", function() {
+ var actual, expected, el;
+
+ el = jQuery('<div />').appendTo(document.body);
+ jquery.twStylesheet("div { overflow: hidden; }");
+ actual = jQuery(el).css("overflow");
+ expected = "hidden";
+ same(actual, expected, "applies style definitions to document");
+ // teardown
+ jQuery(el).remove();
+ jquery.twStylesheet.remove();
+
+ el = jQuery('<div />').appendTo(document.body);
+ jquery.twStylesheet("div { font-style: italic; }");
+ actual = jQuery(el).css("font-style");
+ expected = "italic";
+ same(actual, expected, "applies style definitions to
newly-created elements");
+ // teardown
+ jQuery(el).remove();
+ jquery.twStylesheet.remove();
+
+ jquery.twStylesheet("", { id: "dummyStyleSheet" });
+ actual = jQuery("#dummyStyleSheet").length;
+ expected = 1;
+ same(actual, expected, "generates style element using given
ID");
+ // teardown
+ jquery.twStylesheet.remove({ id: "dummyStyleSheet" });
+
+ // TODO: test for options.doc argument
+
+ });
+
+ test("remove", function() {
+ var actual, expected;
+
+ // setup
+ el = jQuery('<div />').appendTo(document.body);
+ jquery.twStylesheet("div { overflow: hidden; }");
+ // test
+ jquery.twStylesheet.remove();
+ actual = jQuery(el).css("overflow");
+ expected = "visible";
+ same(actual, expected, "neutralizes style definitions");
+ // teardown
+ jQuery(el).remove();
+
+ // setup
+ jquery.twStylesheet("");
+ // test
+ jquery.twStylesheet.remove();
+ actual = jQuery("#customStyleSheet").length;
+ expected = 0;
+ same(actual, expected, "removes default style sheet if no ID is
given");
+
+ // setup
+ jquery.twStylesheet("", { id: "dummyStyleSheet" });
+ // test
+ jquery.twStylesheet.remove({ id: "dummyStyleSheet" });
+ actual = jQuery("#dummyStyleSheet").length;
+ expected = 0;
+ same(actual, expected, "removes style element using given ID");
+
+ // TODO: test for options.doc argument
+
+ });
+});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---