Tengo algunos problemas para obtener una de las páginas de mi sitio con IE8. Funciona bien en IE9, Safari (ambos PC & Mac) & Firefox (Mac). Estoy usando una secuencia find(tag1).html(tag1)
llamada a hacer un cambio de título, pero me sale el siguiente error en IE8 cuando depurarlo en el depurador de scripts IE, y esto en la función html(tag2)
:jQuery .find() error: "Llamada inesperada al método o acceso a la propiedad"
Unexpected call to method or property access
La función find(tag1)
parece para devolver el objeto adjunto (es decir, #sidebar
), en lugar del objeto anidado #sidebarheader
, y esto causa problemas cuando se realiza la llamada html(tag2)
.
He creado un caso de prueba representativa de la siguiente manera:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JQuery .find() test case</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script type="text/javascript">
function UpdateHeader() {
$('#sidebar').find('header').html("New Title"); // IE8, nesting div's in the find fct. will not discover the child div
}
document.ready = UpdateHeader;
</script>
</head>
<body>
<div style="height: 400px; width: 390px">
<div id="jqm-home">
<div id="page">
<div id="sidebar">
<div id="sidebarheader">
<header>Old Title</header>
</div>
</div>
</div>
<p onclick="UpdateHeader();">Click to update title</p>
</div>
</div>
</body>
</html>
Y aquí está el caso de prueba jsFiddle:
Alguien ha una sugerencia sobre cómo conseguir que esto funcione en IE8?