Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fusejs: Remove unused legacy PrototypeJS files. [jddalton]

  • Loading branch information...
commit e7d8241bb477cbf75f890c01146b9484123c87ef 1 parent 18929db
@jdalton jdalton authored
View
3  .gitignore
@@ -1,3 +1,2 @@
.DS_Store
-test/unit/tmp
-pkg
+test/unit/tmp
View
33 Rakefile
@@ -1,17 +1,13 @@
require 'rake'
-require 'rake/packagetask'
FUSEJS_ROOT = File.expand_path(File.dirname(__FILE__))
FUSEJS_SRC_DIR = File.join(FUSEJS_ROOT, 'src')
FUSEJS_DIST_DIR = File.join(FUSEJS_ROOT, 'dist')
-FUSEJS_PKG_DIR = File.join(FUSEJS_ROOT, 'pkg')
FUSEJS_TEST_DIR = File.join(FUSEJS_ROOT, 'test')
FUSEJS_TMP_DIR = File.join(FUSEJS_TEST_DIR, 'unit', 'tmp')
FUSEJS_VERSION = 'Alpha'
-PROTOTYPE_VERSION = '1.6.0.3'
-
-task :default => [:dist, :dist_helper, :package, :clean_package_source]
+task :default => [:dist]
desc "Builds the distribution."
task :dist do
@@ -25,30 +21,6 @@ task :dist do
end
end
-desc "Builds the updating helper."
-task :dist_helper do
- $:.unshift File.join(FUSEJS_ROOT, 'lib')
- require 'protodoc'
-
- Dir.chdir(File.join(FUSEJS_ROOT, 'ext', 'update_helper')) do
- File.open(File.join(FUSEJS_DIST_DIR, 'prototype_update_helper.js'), 'w+') do |dist|
- dist << Protodoc::Preprocessor.new('prototype_update_helper.js')
- end
- end
-end
-
-Rake::PackageTask.new('fuse', FUSEJS_VERSION) do |package|
- package.need_tar_gz = true
- package.package_dir = FUSEJS_PKG_DIR
- package.package_files.include(
- '[A-Z]*',
- 'dist/fuse.js',
- 'lib/**',
- 'src/**',
- 'test/**'
- )
-end
-
desc "Builds the distribution and the test suite, runs the tests and collects their results."
task :test => [:dist, :test_units]
@@ -84,9 +56,6 @@ task :build_unit_tests => [:dist] do
end
end
-task :clean_package_source do
- rm_rf File.join(FUSEJS_PKG_DIR, "fuse-#{FUSEJS_VERSION}")
-end
desc 'Generates an empty tmp directory for building tests.'
task :clean_tmp do
View
302 ext/update_helper/prototype_update_helper.html
@@ -1,302 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <title>Prototype Unit test file</title>
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <script src="../../dist/fuse.js" type="text/javascript"></script>
- <script src="../../dist/prototype_update_helper.js" type="text/javascript"></script>
- <script src="../../test/lib/assets/unittest.js" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" href="../../test/lib/assets/test.css" type="text/css" charset="utf-8">
-</head>
-<body>
-<h1>Prototype Unit test file</h1>
-<p>
- Test of deprecation.js
-</p>
-
-<div id="foo">foo</div>
-<div id="bar">bar</div>
-<div id="bla">bla</div>
-
-<!-- Log output -->
-<div id="testlog"> </div>
-
-
-<!-- Tests follow -->
-<script type="text/javascript" charset="utf-8">
- var log = {
- 'message': [],
- 'type': []
- };
-
- prototypeUpdateHelper.notify = prototypeUpdateHelper.notify.wrap(function(proceed, message, type) {
- if (!proceed(message, type)) return; // UpdateHelper#notify return false if the message is not logged.
- log.message.push(message);
- log.type.push(type);
- });
-
- Array.prototype.beforeLast = function() {
- return this[this.length - 2];
- }
-
- Test.Unit.Testcase.addMethods({
- 'assertInfoNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertInfoNotified');
- this.assertEqual('info', actualType, 'assertInfoNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertErrorNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertErrorNotified');
- this.assertEqual('error', actualType, 'assertErrorNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertWarnNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertWarnNotified');
- this.assertEqual('warn', actualType, 'assertWarnNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertNotNotified': function() {
- this.assertEmpty(log.message, 'assertNotNotified');
- this.assertEmpty(log.type, 'assertNotNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertEmpty': function(array, message) {
- this.assertEqual(0, array.length, message || '');
- }
- });
-
- new Test.Unit.Runner({
- 'testGetStack': function() {
- this.assertMatch(/prototype_update_helper\.html:\d+\n$/, prototypeUpdateHelper.getStack());
- },
-
- 'testDisplay': function() {
- Toggle.display('foo');
- this.assertInfoNotified('Toggle.display has been deprecated, please use Element.toggle instead.');
-
- Element.show('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.show is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.show) or $(id_1, id_2, ...).invoke("show") instead.');
-
- $('foo', 'bar', 'bla').each(Element.hide);
- this.assertNotNotified();
-
- Element.show('foo');
- this.assertNotNotified();
-
- Element.hide('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.hide is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.hide) or $(id_1, id_2, ...).invoke("hide") instead.');
-
- Element.toggle('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.toggle is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.toggle) or $(id_1, id_2, ...).invoke("toggle") instead.');
- },
-
- 'testElementStyle': function() {
- Element.setStyle('foo', { 'fontSize': '18px' });
- this.assertNotNotified();
-
- Element.setStyle('foo', { 'font-size': '18px' });
- this.assertErrorNotified('Use of uncamelized style-property names is no longer supported.\n' +
- 'Use either camelized style-property names or a regular CSS string instead (see online documentation).')
-
- Element.setStyle('foo', 'font-size: 18px;');
- this.assertNotNotified();
-
- $('foo').setStyle({ 'font-size': '18px' });
- this.assertErrorNotified('Use of uncamelized style-property names is no longer supported.\n' +
- 'Use either camelized style-property names or a regular CSS string instead (see online documentation).')
- },
-
- 'testClassNames': function() {
- new Element.ClassNames('foo');
- this.assertInfoNotified('Element.ClassNames has been deprecated.')
-
- $('foo').classNames();
- this.assertInfoNotified('Element#classNames has been deprecated.\n' +
- 'If you need to access CSS class names as an array, try: $w(element.classname).')
-
- Element.getElementsByClassName('foo', 'className');
- this.assertInfoNotified('Element#getElementsByClassName has been deprecated, please use Element#select instead.')
-
- document.getElementsByClassName('className');
- this.assertInfoNotified('document.getElementsByClassName has been deprecated, please use $$ instead.')
- },
-
- 'testDomSelectors': function() {
- Element.childOf('foo', 'bar');
- this.assertInfoNotified('Element#childOf has been deprecated, please use Element#descendantOf instead.');
-
- $('foo').immediateDescendants();
- this.assertInfoNotified('Element#immediateDescendants has been deprecated, please use Element#childElements instead.');
-
- $('foo').getElementsBySelector('a');
- this.assertInfoNotified('Element#getElementsBySelector has been deprecated, please use Element#select instead.');
-
- $('foo').select('a');
- this.assertNotNotified();
- },
-
- 'testField': function() {
- var foo = new Element('input'),
- bar = new Element('input'),
- bla = new Element('input');
-
- Field.clear(foo, bar, bla);
- this.assertErrorNotified('Passing an arbitrary number of elements to Field.clear is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.clear) or $(id_1, id_2, ...).invoke("clear") instead.');
-
- Field.present(foo, bar, bla);
- this.assertErrorNotified('Passing an arbitrary number of elements to Field.present is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.present) or $(id_1, id_2, ...).invoke("present") instead.');
- },
-
- 'testInsertion': function() {
- Insertion.Before('foo', 'text');
- this.assertInfoNotified('Insertion.Before has been deprecated, please use Element#insert instead.');
-
- Insertion.Top('foo', 'text');
- this.assertInfoNotified('Insertion.Top has been deprecated, please use Element#insert instead.');
-
- Insertion.Bottom('foo', 'text');
- this.assertInfoNotified('Insertion.Bottom has been deprecated, please use Element#insert instead.');
-
- Insertion.After('foo', 'text');
- this.assertInfoNotified('Insertion.After has been deprecated, please use Element#insert instead.');
- },
-
- 'testPosition': function() {
- Position.prepare('foo');
- this.assertInfoNotified('Position.prepare has been deprecated.');
-
- Position.within('foo');
- this.assertInfoNotified('Position.within has been deprecated.');
-
- Position.withinIncludingScrolloffsets('foo');
- this.assertInfoNotified('Position.withinIncludingScrolloffsets has been deprecated.');
-
- Position.overlap('foo');
- this.assertInfoNotified('Position.overlap has been deprecated.');
-
- Position.cumulativeOffset('foo');
- this.assertInfoNotified('Position.cumulativeOffset has been deprecated, please use Element#cumulativeOffset instead.');
-
- Position.positionedOffset('foo');
- this.assertInfoNotified('Position.positionedOffset has been deprecated, please use Element#positionedOffset instead.');
-
- Position.absolutize('foo');
- this.assertInfoNotified('Position.absolutize has been deprecated, please use Element#absolutize instead.');
-
- Position.relativize('foo');
- this.assertInfoNotified('Position.relativize has been deprecated, please use Element#relativize instead.');
-
- Position.realOffset('foo');
- this.assertInfoNotified('Position.realOffset has been deprecated, please use Element#cumulativeScrollOffset instead.');
-
- Position.offsetParent('foo');
- this.assertInfoNotified('Position.offsetParent has been deprecated, please use Element#getOffsetParent instead.');
-
- Position.page('foo');
- this.assertInfoNotified('Position.page has been deprecated, please use Element#viewportOffset instead.');
-
- Position.clone('foo', 'bar');
- this.assertInfoNotified('Position.clone has been deprecated, please use Element#clonePosition instead.');
- },
-
- 'testEvent': function() {
- Event.unloadCache();
- this.assertErrorNotified('Event.unloadCache has been deprecated.')
- },
-
- 'testHash': function() {
- Hash.toQueryString({});
- this.assertInfoNotified('Hash.toQueryString has been deprecated.\n' +
- 'Use the instance method Hash#toQueryString or Object.toQueryString instead.');
-
- Hash.toJSON({});
- this.assertErrorNotified('Hash.toJSON has been removed.\n' +
- 'Use the instance method Hash#toJSON or Object.toJSON instead.');
-
- var h = $H({ foo: 2 });
-
- h.remove('foo');
- this.assertErrorNotified('Hash#remove is no longer supported, use Hash#unset instead.\n' +
- 'Please note that Hash#unset only accepts one argument.');
-
- h.merge('foo');
- this.assertWarnNotified('Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' + 'If you need a destructive merge, use Hash#update instead.');
-
- h['foo'];
- this.assertErrorNotified('Directly accessing a property of an instance of Hash is no longer supported.\n' +
- 'Please use Hash#get(\'foo\') instead.')
-
- h.foo = 3;
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'foo\', 3) instead.')
-
- h.bar = 'bar';
- h.toJSON();
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'bar\', \'bar\') instead.')
-
- h.bar;
- this.assertErrorNotified('Directly accessing a property of an instance of Hash is no longer supported.\n' +
- 'Please use Hash#get(\'bar\') instead.')
-
- h.baz = 'baz';
- h.bar;
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'baz\', \'baz\') instead.')
-
- h.set('toJSON', 'arg'); // make sure hash methods are not overwritten
- this.assertRespondsTo('toJSON', h)
- },
-
- /* Commented out because Array#inject uses native Array#reduce
- 'testArray': function() {
- var a = [0, 1, 2, 3];
- a.reduce(function(){ });
- this.assertErrorNotified('Array#reduce is no longer supported.\n' +
- 'This is due to an unfortunate naming collision with Mozilla\'s own implementation of Array#reduce which differs completely from Prototype\'s implementation (it\'s in fact similar to Prototype\'s Array#inject).\n' +
- 'Mozilla\'s Array#reduce is already implemented in Firefox 3 (as part of JavaScript 1.8) and is about to be standardized in EcmaScript 3.1.')
- }, */
-
- 'testClass': function() {
- Class.create();
- this.assertInfoNotified('The class API has been fully revised and now allows for mixins and inheritance.\n' +
- 'You can find more about it here: http://prototypejs.org/learn/class-inheritance');
- Class.create({});
- this.assertNotNotified();
- },
-
- 'testLogDeprecationOption': function() {
- prototypeUpdateHelper.logLevel = UpdateHelper.Warn;
- var h = $H({ foo: 2 });
-
- h.merge({ foo: 3 });
- this.assertWarnNotified('Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' + 'If you need a destructive merge, use Hash#update instead.');
-
- h.remove('foo');
- this.assertErrorNotified('Hash#remove is no longer supported, use Hash#unset instead.\n' +
- 'Please note that Hash#unset only accepts one argument.');
-
- document.getElementsByClassName('className');
- this.assertNotNotified();
- prototypeUpdateHelper.logLevel = UpdateHelper.Info;
- }
- });
-</script>
-</body>
-</html>
View
383 ext/update_helper/prototype_update_helper.js
@@ -1,383 +0,0 @@
-<%= include "update_helper.js" %>
-
-/* UpdateHelper for Prototype <%= PROTOTYPE_VERSION %> (c) 2008 Tobie Langel
- *
- * UpdateHelper for Prototype is freely distributable under the same
- * terms as Prototype (MIT-style license).
- * For details, see the Prototype web site: http://www.prototypejs.org/
- *
- * Include this file right below prototype.js. All messages
- * will be logged to the console.
- *
- * Note: You can tune the level of warning by redefining
- * prototypeUpdateHelper.logLevel with one of the appropriate constansts
- * (UpdateHelper.Info, UpdateHelper.Warn or UpdateHelper.Error), e.g.:
- *
- * prototypeUpdateHelper.logLevel = UpdateHelper.Warn;
- *
- * This, for example, will prevent deprecation messages from being logged.
- *
- * THIS SCRIPT WORKS IN FIREFOX ONLY
- *--------------------------------------------------------------------------*/
-
-var prototypeUpdateHelper = new UpdateHelper([
- {
- methodName: 'display',
- namespace: Toggle,
- message: 'Toggle.display has been deprecated, please use Element.toggle instead.'
- },
-
- {
- methodName: 'show',
- namespace: Element.Methods,
- message: 'Passing an arbitrary number of elements to Element.show is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.show) or $(id_1, id_2, ...).invoke("show") instead.',
- type: 'error',
- condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
- },
-
- {
- methodName: 'hide',
- namespace: Element.Methods,
- message: 'Passing an arbitrary number of elements to Element.hide is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.hide) or $(id_1, id_2, ...).invoke("hide") instead.',
- type: 'error',
- condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
- },
-
- {
- methodName: 'toggle',
- namespace: Element.Methods,
- message: 'Passing an arbitrary number of elements to Element.toggle is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.toggle) or $(id_1, id_2, ...).invoke("toggle") instead.',
- type: 'error',
- condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
- },
-
- {
- methodName: 'clear',
- namespace: Form.Element.Methods,
- message: 'Passing an arbitrary number of elements to Field.clear is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.clear) or $(id_1, id_2, ...).invoke("clear") instead.',
- type: 'error',
- condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
- },
-
- {
- methodName: 'present',
- namespace: Form.Element.Methods,
- message: 'Passing an arbitrary number of elements to Field.present is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.present) or $(id_1, id_2, ...).invoke("present") instead.',
- type: 'error',
- condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
- },
-
- {
- methodName: 'childOf',
- namespace: Element.Methods,
- message: 'Element#childOf has been deprecated, please use Element#descendantOf instead.'
- },
-
- {
- methodName: 'Before',
- namespace: Insertion,
- message: 'Insertion.Before has been deprecated, please use Element#insert instead.'
- },
-
- {
- methodName: 'Top',
- namespace: Insertion,
- message: 'Insertion.Top has been deprecated, please use Element#insert instead.'
- },
-
- {
- methodName: 'Bottom',
- namespace: Insertion,
- message: 'Insertion.Bottom has been deprecated, please use Element#insert instead.'
- },
-
- {
- methodName: 'After',
- namespace: Insertion,
- message: 'Insertion.After has been deprecated, please use Element#insert instead.'
- },
-
- {
- methodName: 'prepare',
- namespace: Position,
- message: 'Position.prepare has been deprecated.'
- },
-
- {
- methodName: 'within',
- namespace: Position,
- message: 'Position.within has been deprecated.'
- },
-
- {
- methodName: 'withinIncludingScrolloffsets',
- namespace: Position,
- message: 'Position.withinIncludingScrolloffsets has been deprecated.'
- },
-
- {
- methodName: 'overlap',
- namespace: Position,
- message: 'Position.overlap has been deprecated.'
- },
-
- {
- methodName: 'cumulativeOffset',
- namespace: Position,
- message: 'Position.cumulativeOffset has been deprecated, please use Element#cumulativeOffset instead.'
- },
-
- {
- methodName: 'positionedOffset',
- namespace: Position,
- message: 'Position.positionedOffset has been deprecated, please use Element#positionedOffset instead.'
- },
-
- {
- methodName: 'absolutize',
- namespace: Position,
- message: 'Position.absolutize has been deprecated, please use Element#absolutize instead.'
- },
-
- {
- methodName: 'relativize',
- namespace: Position,
- message: 'Position.relativize has been deprecated, please use Element#relativize instead.'
- },
-
- {
- methodName: 'realOffset',
- namespace: Position,
- message: 'Position.realOffset has been deprecated, please use Element#cumulativeScrollOffset instead.'
- },
-
- {
- methodName: 'offsetParent',
- namespace: Position,
- message: 'Position.offsetParent has been deprecated, please use Element#getOffsetParent instead.'
- },
-
- {
- methodName: 'page',
- namespace: Position,
- message: 'Position.page has been deprecated, please use Element#viewportOffset instead.'
- },
-
- {
- methodName: 'clone',
- namespace: Position,
- message: 'Position.clone has been deprecated, please use Element#clonePosition instead.'
- },
-
- {
- methodName: 'initialize',
- namespace: Element.ClassNames.prototype,
- message: 'Element.ClassNames has been deprecated.'
- },
-
- {
- methodName: 'classNames',
- namespace: Element.Methods,
- message: 'Element#classNames has been deprecated.\n' +
- 'If you need to access CSS class names as an array, try: $w(element.classname).'
- },
-
- {
- methodName: 'setStyle',
- namespace: Element.Methods,
- message: 'Use of uncamelized style-property names is no longer supported.\n' +
- 'Use either camelized style-property names or a regular CSS string instead (see online documentation).',
- type: 'error',
- condition: function(element, style) {
- return !Object.isString(style) && Object.keys(style).join('').include('-');
- }
- },
-
- {
- methodName: 'getElementsByClassName',
- namespace: document,
- message: 'document.getElementsByClassName has been deprecated, please use $$ instead.'
- },
-
- {
- methodName: 'getElementsByClassName',
- namespace: Element.Methods,
- message: 'Element#getElementsByClassName has been deprecated, please use Element#select instead.'
- },
-
- {
- methodName: 'immediateDescendants',
- namespace: Element.Methods,
- message: 'Element#immediateDescendants has been deprecated, please use Element#childElements instead.'
- },
-
- {
- methodName: 'getElementsBySelector',
- namespace: Element.Methods,
- message: 'Element#getElementsBySelector has been deprecated, please use Element#select instead.'
- },
-
- {
- methodName: 'toQueryString',
- namespace: Hash,
- message: 'Hash.toQueryString has been deprecated.\n' +
- 'Use the instance method Hash#toQueryString or Object.toQueryString instead.'
- },
-
- {
- methodName: 'toJSON',
- namespace: Hash,
- message: 'Hash.toJSON has been removed.\n' +
- 'Use the instance method Hash#toJSON or Object.toJSON instead.',
- type: 'error'
- },
-
- {
- methodName: 'remove',
- namespace: Hash.prototype,
- message: 'Hash#remove is no longer supported, use Hash#unset instead.\n' +
- 'Please note that Hash#unset only accepts one argument.',
- type: 'error'
- },
-
- {
- methodName: 'merge',
- namespace: Hash.prototype,
- message: 'Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' +
- 'If you need a destructive merge, use Hash#update instead.',
- type: 'warn'
- },
-
- /* Commented out because Array#inject uses native Array#reduce
- {
- methodName: 'reduce',
- namespace: Array.prototype,
- message: 'Array#reduce is no longer supported.\n' +
- 'This is due to an unfortunate naming collision with Mozilla\'s own implementation of Array#reduce which differs completely from Prototype\'s implementation (it\'s in fact similar to Prototype\'s Array#inject).\n' +
- 'Mozilla\'s Array#reduce is already implemented in Firefox 3 (as part of JavaScript 1.8) and is about to be standardized in EcmaScript 3.1.',
- type: 'error'
- }, */
-
- {
- methodName: 'unloadCache',
- namespace: Event,
- message: 'Event.unloadCache has been deprecated.',
- type: 'error'
- },
-
- {
- methodName: 'create',
- namespace: Class,
- message: 'The class API has been fully revised and now allows for mixins and inheritance.\n' +
- 'You can find more about it here: http://prototypejs.org/learn/class-inheritance',
- condition: function() { return !arguments.length }
- },
-
- {
- methodName: 'register',
- namespace: Ajax.Responders,
- message: 'The Ajax.Responders.responders property is no longer an Array object.\n' +
- 'It is now an Object object with callback names as properties.\n' +
- 'These properties are arrays containing the responders for the respective callback.\n\n' +
- 'For example, the following will access the first responder of the "onComplete" callback:\n' +
- ' Ajax.Responders.responders.onComplete[0]',
- type: 'warn'
- }
-]);
-
-// Special casing for Hash.
-
-(function() {
- var __properties = Object.keys(Hash.prototype).concat(['_object', '__properties']);
-
- var messages = {
- setting: new Template("Directly setting a property on an instance of Hash is no longer supported.\n" +
- "Please use Hash#set('#{property}', #{value}) instead."),
- getting: new Template("Directly accessing a property of an instance of Hash is no longer supported.\n" +
- "Please use Hash#get('#{property}') instead.")
- };
-
- function getKeys(obj) {
- var key, results = [];
- for (key in obj) {
- if (Object.hasKey(obj, key))
- results.push(key);
- }
- return results;
- }
-
- function notify(property, value) {
- var message = messages[arguments.length == 1 ? 'getting' : 'setting'].evaluate({
- property: property,
- value: Object.inspect(value)
- });
- prototypeUpdateHelper.notify(message, 'error');
- }
-
- function defineSetters(obj, prop) {
- storeProperties(obj);
- if (obj.__properties.include(prop)) return;
- obj.__properties.push(prop);
- obj.__defineGetter__(prop, function() {
- checkProperties(this);
- notify(prop);
- });
- obj.__defineSetter__(prop, function(value) {
- checkProperties(this);
- notify(prop, value);
- });
- }
-
- function checkProperties(hash) {
- storeProperties(hash);
-
- // avoid infinite loop in Object.keys() caused by the __getter__
- var current = getKeys(hash);
- if (current.length == hash.__properties.length)
- return;
- current.each(function(prop) {
- if (hash.__properties.include(prop)) return;
- notify(prop, hash[prop]);
- defineSetters(hash, prop);
- });
- }
-
- function storeProperties(h) {
- if (typeof h.__properties === 'undefined')
- h.__properties = __properties.clone();
- return h;
- }
-
- Hash.prototype.set = Hash.prototype.set.wrap(function(proceed, property, value) {
- defineSetters(this, property);
- return proceed(property, value);
- });
-
- $w('merge update').each(function(name) {
- Hash.prototype[name] = Hash.prototype[name].wrap(function(proceed, object) {
- for (var prop in object) defineSetters(this, prop);
- return proceed(object);
- });
- });
-
- $H(Hash.prototype).each(function(method) {
- var key = method.key;
- if (!Object.isFunction(method.value) || key == 'initialize') return;
- Hash.prototype[key] = Hash.prototype[key].wrap(function(proceed) {
- checkProperties(this);
- return proceed.apply(proceed, $A(arguments).splice(1));
- });
- });
-
- Hash.prototype.initialize = Hash.prototype.initialize.wrap(function(proceed, object) {
- storeProperties(this);
- for (var prop in object) defineSetters(this, prop);
- proceed(object);
- });
-})();
-
View
75 ext/update_helper/update_helper.js
@@ -1,75 +0,0 @@
-/* Update Helper (c) 2008 Tobie Langel
- *
- * Requires Prototype >= 1.6.0
- *
- * Update Helper is distributable under the same terms as Prototype
- * (MIT-style license). For details, see the Prototype web site:
- * http://www.prototypejs.org/
- *
- *--------------------------------------------------------------------------*/
-
-var UpdateHelper = Class.create({
- logLevel: 0,
- MessageTemplate: new Template('Update Helper: #{message}\n#{stack}'),
- Regexp: new RegExp("@" + window.location.protocol + ".*?\\d+\\n", "g"),
-
- initialize: function(deprecatedMethods) {
- var notify = function(message, type) {
- this.notify(message, type);
- }.bind(this); // Late binding to simplify testing.
-
- deprecatedMethods.each(function(d) {
- var condition = d.condition,
- type = d.type || 'info',
- message = d.message,
- namespace = d.namespace,
- method = d.methodName;
-
- namespace[method] = (namespace[method] || function() {}).wrap(function(proceed) {
- var args = $A(arguments).splice(1);
- if (!condition || condition.apply(this, args)) notify(message, type);
- return proceed.apply(proceed, args);
- });
- });
- Element.addMethods();
- },
-
- notify: function(message, type) {
- switch(type) {
- case 'info':
- if (this.logLevel > UpdateHelper.Info) return false;
- case 'warn':
- if (this.logLevel > UpdateHelper.Warn) return false;
- default:
- if (this.logLevel > UpdateHelper.Error) return false;
- }
- this.log(this.MessageTemplate.evaluate({
- message: message,
- stack: this.getStack()
- }), type);
- return true;
- },
-
- getStack: function() {
- try {
- throw new Error("stack");
- } catch(e) {
- return (e.stack || '').match(this.Regexp).reject(function(path) {
- return /(fuse|prototype|unittest|update_helper)\.js/.test(path);
- }).join("\n");
- }
- },
-
- log: function(message, type) {
- if (type == 'error') console.error(message);
- else if (type == 'warn') console.warn(message);
- else console.log(message);
- }
-});
-
-Object.extend(UpdateHelper, {
- Info: 0,
- Warn: 1,
- Error: 2
-});
-
Please sign in to comment.
Something went wrong with that request. Please try again.