Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes 2129. #2168

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions Source/Element/Element.js
Expand Up @@ -579,6 +579,23 @@ propertyGetters['class'] = function(node){
return ('className' in node) ? node.className || null : node.getAttribute('class');
};

/* <ltIE9> */
if (Browser.ie && Browser.version < 9) propertySetters.src = function(node, value){
if (node.get('tag') != 'img') return node.src = value;

var width = Object.clone(node.getAttributeNode('width')),
height = Object.clone(node.getAttributeNode('height'));

node.src = value;

if (width.specified) node.style.width = width.nodeValue;
if (height.specified) node.style.height = height.nodeValue;

node.removeAttribute('width');
node.removeAttribute('height');
};
/* </ltIE9> */

/* <webkit> */
var el = document.createElement('button');
// IE sets type as readonly and throws
Expand Down
2 changes: 1 addition & 1 deletion Specs/1.4client/Element/Element.Event.change.html
Expand Up @@ -123,7 +123,7 @@ <h1>Change</h1>
log('change bubbles', true);
});
</script>

</div>

</body>
Expand Down
153 changes: 153 additions & 0 deletions Specs/1.4client/Element/Element.src.html
@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

<title>Element.set('src') specs</title>

<script src="../../../Source/Core/Core.js" type="text/javascript"></script>
<script src="../../../Source/Types/Array.js" type="text/javascript"></script>
<script src="../../../Source/Types/Function.js" type="text/javascript"></script>
<script src="../../../Source/Types/Number.js" type="text/javascript"></script>
<script src="../../../Source/Types/String.js" type="text/javascript"></script>
<script src="../../../Source/Types/Object.js" type="text/javascript"></script>
<script src="../../../Source/Types/DOMEvent.js" type="text/javascript"></script>
<script src="../../../Source/Browser/Browser.js" type="text/javascript"></script>
<script src="../../../Source/Slick/Slick.Parser.js" type="text/javascript"></script>
<script src="../../../Source/Slick/Slick.Finder.js" type="text/javascript"></script>
<script src="../../../Source/Element/Element.js" type="text/javascript"></script>
<script src="../../../Source/Element/Element.Event.js" type="text/javascript"></script>

<style>

body {
font: 13px sans-serif;
}

h1 {
border-top: 1px dashed #AAA;
font: normal 22px sans-serif;
margin: 5px 0;
padding-top: 10px;
}

#content {
top: 0;
bottom: 0;
left: 370px;
position: absolute;
overflow: auto;
padding-bottom: 150px;
right: 0;
}

#aside {
background: #F5F5F5;
border-right: 1px dashed #AAA;
bottom: 0;
font-family: monospace;
left: 0;
margin-right: 10px;
overflow: auto;
padding: 10px;
position: absolute;
top: 0;
width: 340px;
}

.success {
background: greenyellow;
}

.fail {
background: orangered;
}

.box {
background: greenyellow;
border: 1px solid black;
padding: 10px;
width: 300px;
}

.note {
font-size: small;
color: gray;
}

</style>

</head>
<body>

<div id="aside">
<h2>Log</h2>
<div id="log"></div>
</div>

<script>

var logger = $('log');
function log(msg, success){
new Element('div', {
'class': success == true ? 'success' : (success == false ? 'fail' : ''),
text: msg
}).inject(logger);
};

</script>

<div id="content">
<h2>Instructions</h2>
<ol>
<li>Refresh a couple of times so that Internet Explorer caches the image.</li>
<li>Click on each image to swap the image with another (much smaller) image.</li>
</ol>

<div id="sandbox">
<h3>Original</h3>
<img id="original" src="http://blog.accessko.nl/wp-content/uploads/2009/06/logo-mootools.gif" alt="">

<h3>Styled</h3>
<p class="note">Note: this should stay the size specified (90px).</p>
<img src="http://blog.accessko.nl/wp-content/uploads/2009/06/logo-mootools.gif" style="width:90px" alt="">

<h3>Half as large</h3>
<p class="note">Note: this should stay the size specified (90px).</p>
<img id="half-as-large" width="90" src="http://blog.accessko.nl/wp-content/uploads/2009/06/logo-mootools.gif" alt="">

<h3>Pull and Push</h3>
<p class="note">Note: this should stay the size specified (90px).</p>
<div id="target">
<img id="pull-push" src="http://blog.accessko.nl/wp-content/uploads/2009/06/logo-mootools.gif" width="90" alt="">
</div>

<h3>Missing src</h3>
<img id="missing" alt="">

<h3>Dynamically Created (this is buggy in IE)</h3>
</div>

<div id="actions">
</div>

<script>
new Element('img', {
id: 'dynamic',
src: 'http://blog.accessko.nl/wp-content/uploads/2009/06/logo-mootools.gif'
}).inject('sandbox')

$('pull-push').dispose().set('src', 'http://www.figureone.com/favicon.png').inject('target');

$$('#sandbox img').addEvent('click', function(){
this.set('src', 'http://www.figureone.com/favicon.png');
});

$('missing').set('src', 'http://www.figureone.com/favicon.png');
</script>

</div>

</body>
</html>

2 changes: 2 additions & 0 deletions Specs/index.html
Expand Up @@ -21,6 +21,8 @@ <h1><strong>Specs</strong> for <script>document.write(Configuration.name);</scri
</script>
<li><a href="1.3client/Utilities/DOMReady.php">&rarr; 1.3 DOMReady</a></li>
<li><a href="1.4client/Element/Element.Delegation.html">&rarr; 1.4 Delegation</a></li>
<li><a href="1.4client/Element/Element.Event.change.html">&rarr; 1.4 Element change event (IE only)</a></li>
<li><a href="1.4client/Element/Element.src.html">&rarr; 1.4 Element src (IE only)</a></li>
</ul>

</div>
Expand Down