forked from savetheclocktower/javascript-stuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquotes.js
More file actions
32 lines (31 loc) · 875 Bytes
/
quotes.js
File metadata and controls
32 lines (31 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* A script for fixing the Q tag in Internet Explorer.
*
* Inspired by [http://plugins.jquery.com/project/QinIE].
*
* KNOWN ISSUES:
* Doesn't yet handle quotation marks from non-American locales.
*
* NOTE:
* This script does no browser checking. Load it via an IE
* conditional comment.
*
*/
(function() {
var QUOTES = {
'single': ["‘", "&rsquo"],
'double': ["“", "”"]
};
function fixQuotes(q, quoteType) {
if (q._handledByPrototype) return;
var nestedQ = q.down('q');
if (nestedQ) {
arguments.callee(nestedQ, quoteType == "double" ? "single" : "double");
}
q.insert({ top: QUOTES[quoteType][0], bottom: QUOTES[quoteType][1] });
q._handledByPrototype = true;
}
document.observe("dom:loaded", function() {
$$('q').each( function(q) { fixQuotes(q, "double"); });
});
})();