Does XCode compress/minify JS when running a project in the iOS Simulator? I'm trying to debug a JS file using jQuery, and one of the ways I get at error data in the iOS Simulator is like this:
$(window).error(function(err) {
alert('Msg: ' + err.originalEvent.message + ' | Lno: ' + err.originalEvent.lineno);
}):
The problem is that the only line number alerted is 0. The message property works fine. When I run the same code on my desktop using a desktop browser, I can get at the lineno property of the originalEvent object without issue, so I'm guessing XCode does something to my JS when it builds the project.
Any way to turn this off?
After a bit more debugging (and using the printObject function from this thread: Print content of JavaScript object?), it appears that most of the error object's properties are available in the iOS Simulator. For some reason, lineno only ever has a value of 0, however.
This is all from the iOS Simulator's JS error object:
message: ReferenceError: Can't find variable: URL
lineno: 0
returnValue: true
timeStamp: 1328890716292
eventPhase: 2
target: [object DOMWindow]
defaultPrevented: false
srcElement: [object DOMWindow]
type: error
clipboardData: undefined
cancelable: true
currentTarget: [object DOMWindow]
bubbles: false
cancelBubble: false
initErrorEvent: function initErrorEvent() {
[native code]
}
preventDefault: function preventDefault() {
[native code]
}
initEvent: function initEvent() {
[native code]
}
stopPropagation: function stopPropagation() {
[native code]
}
stopImmediatePropagation: function stopImmediatePropagation() {
[native code]
}
MOUSEOUT: 8
FOCUS: 4096
CHANGE: 32768
MOUSEMOVE: 16
AT_TARGET: 2
SELECT: 16384
BLUR: 8192
KEYUP: 512
MOUSEDOWN: 1
MOUSEDRAG: 32
BUBBLING_PHASE: 3
MOUSEUP: 2
CAPTURING_PHASE: 1
MOUSEOVER: 4
CLICK: 64
DBLCLICK: 128
KEYDOWN: 256
KEYPRESS: 1024
DRAGDROP: 2048