jQuery illegal character showing up when trying to add jQuery and bootstrap - javascript

The illegal characters seem to be in Japanese? How did this happen?
here is my blank html with jQuery/bootstrap included, firebug gives me:
illegal character line 1 jQuery..min.js
...潡琨昮捳猨愬挫扸孥崩⥼簰⤻牥瑵牮⁤⬢灸≽晵湣瑩潮⁢漨愩筶慲⁢㵣⹣牥慴故汥浥湴⠢摩瘢⤻扨⹡灰敮摃桩汤⡢⤬戮楮湥版呍䰽愮潵瑥版呍䰻牥瑵牮⁢⹦楲獴䍨楬摽晵湣瑩潮⁢渨愩...

Server response begins with 2 "strange" characters before the DOCTYPE declaration (U+02C7 and U+02DB)

Related

selenium IDE javascript replace: Throw an exception: missing ; before statement

I wrote a test using selenium IDE, I need to compare two text that MAY contain the
character, if the strings are equal, it skips to a label. the comparison command
<td>gotoIf</td>
<td>'${var1}'=='${var2}'</td>
<td>skip</td>
works if the character above is not there, but fails with
[error] Threw an exception: missing ; before statement` otherwise
I tried to write a replace statement supposed to replace ' with a blank space (since I don't care if is there or not):
<td>storeEval</td>
<td>javascript{storedVars.var1.replace("\'"," ");}</td>
<td>var1</td>
but it always fails with the same error as above.
what am I missing? can anyone help me?
I took user extension js from here. Can you try with double quote instead of single quote in gotoIf command? It works for me. Please refer my screenshot below.
<td>gotoIf</td>
<td>"${var1}"=="${var2}"</td>
<td>skip</td>

Sublime Text parse error default(windows).sublime-keymap.2:52

Sublime Text 2 wouldn't open. I kept getting this error:
(Error trying to parse file: Unexpected character, expected a comma or closing
bracket in c:\Users\adeleon\AppData\Roaming\Sublime Text 2\Packages\
Default (Windows).sublime-keymap.2:52)
I found the file and put it into JSON Lint. I got this error.
Expecting 'EOF', got ','
The validator says that the problem is on line 2 of the code. I do not see any missing curly brackets. Would somebody please tell me what I am overlooking?
The link to the code is below.
https://github.com/alexwebcoder/jsonFile/blob/master/ff.txt
I think you are missing an open bracket ([) at the very beginning of the code.

Javascript multiline string causing "SyntaxError ILLEGAL"

I have a very basic function on a template that shows an alert message:
<script>
function detailer(pii_other){
alert(pii_other);
}
</script>
it is called with a string value like this:
<td><button onclick="detailer('{{other}}')">Details</button></td>
It works fine on most cases but I saw that it sometimes fails based on the content of 'other'. Uncaught SyntaxError: Unexpected token ILLEGAL on the Chrome Javascript console.
[Edit:]
I am reading the other content from a RESTful API service that returns JSON, in this case the other field has this content:
body: {
other: ""address_street"=>"江西省九江市共青城市 账号 2123123912391239 户名 齐少楠", "name"=>"test""
}
How can I prepare my code to support multiline strings in the alert ? I have no way to restrict the data input in the form.
I would do the same thing Daniel A. White suggested - convert the new lines to some string that won't evaluate to a 'real' new line in your templating engine (Jinja?). You may have to escape the new line character so that it stays on one line.

add class to parent on click with jQuery

I currently have this, it was working in jsFiddle, though its giving me errors, and not working when I use it outside of fiddle.
$('.down-photo').click(function() {
$(this).parent('.img-mask').toggleClass('hide');
});​
Firebug says:
Uncaught SyntaxError: Unexpected Token ILLEGAL
I'm newer to javascript and jQuery so I'm not sure what's wrong or what that error means.
Thanks!
In the code in your question there is a non-printing character after the last semicolon. It seems to be character 8203, a Unicode zero-width space. That's the illegal token that Firebug is telling you about.
You'll notice, if you edit the text in your question, that if you put the cursor to the left of that last semicolon and then press the right arrow a few times it takes one more keypress than you'd expect to get to the next line - that's the character I mean.
Delete that character, or manually retype the line (rather than copy/pasting), and it should be fine.
I fixed your error. $.appendTo() takes a selector, not a jquery object.
Try this:
http://jsfiddle.net/dvCmR/133/ (line 4)

HTML entities with application/xhtml+xml Content-Type

When using the application/xhtml+xml Content-Type I cannot use any named HTML entities in my javascript ( , €, etc.).
It works fine when I use a text/html Content-Type. The offending HTML entities also work fine when put in the document itself (Instead of using Javascript).
When I hit the "F12 developer tools" in IE9, I get the following error:
SCRIPT5022: DOM Exception: SYNTAX_ERR (12)
javascript.js, line 7 character 2
XML5645: The specified entity has not been declared.
, line 1 character 42
Firefox gives a similar error:
[11:19:33.491] undefined entity:1
[11:19:33.493] uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://arp242.net/entity-test/javascript.js Line: 8"]
And then execution stops.
I created a test page for testing/isolating where the problem is: http://arp242.net/entity-test/
As far as I can figure out, named HTML entities are perfectly valid in XHTML (http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-A2)
Does anyone have a clue how to resolve the problem? I can enter the characters (€, —, “, ”, etc.) or numeric &#..; values and that works, but I'd rather use HTML entities. There is also quite a bit of existing (3rd party) code which uses HTML entities and I'd rather not convert all of that.
Thanks!
XML hasn't text named entities, you can define them either in doctype or replace text named entities with char code entites ( eg. is   etc. )
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
( Take unicode code point in decimal )

Categories

Resources