MDL-20044: add test to prevent javascript error due to null data.
This commit is contained in:
@@ -94,8 +94,8 @@ section_class.prototype.init_buttons = function() {
|
||||
commandContainer.appendChild(highlightbutton);
|
||||
this.highlightButton = highlightbutton;
|
||||
}
|
||||
|
||||
if (this.sectionId > 0 ) {
|
||||
|
||||
if (this.sectionId > 0 ) {
|
||||
var viewbutton = main.mk_button('div', '/i/hide.gif', main.getString('hidesection', this.sectionId), [['title', main.portal.strings['hide'] ]]);
|
||||
YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
|
||||
commandContainer.appendChild(viewbutton);
|
||||
@@ -141,12 +141,12 @@ section_class.prototype.process_section = function() {
|
||||
|
||||
// Find/edit resources
|
||||
this.resources_ul = this.content_td.getElementsByTagName('ul')[0];
|
||||
var i=0;
|
||||
while (this.resources_ul && this.resources_ul.className != 'section img-text') {
|
||||
var i=0;
|
||||
while (this.resources_ul && this.resources_ul.className != 'section img-text') {
|
||||
this.resources_ul = this.content_td.getElementsByTagName('ul')[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
if (!this.resources_ul) {
|
||||
this.resources_ul = document.createElement('ul');
|
||||
this.resources_ul.className='section';
|
||||
@@ -158,10 +158,12 @@ section_class.prototype.process_section = function() {
|
||||
var resource = this.resources_ul.getElementsByTagName('li')[i];
|
||||
this.resources[this.resources.length] = new resource_class(resource.id, 'resources', null, this);
|
||||
}
|
||||
this.summary = YAHOO.util.Dom.getElementsByClassName('summary', null, this.getEl())[0].firstChild.data || '';
|
||||
var summarysection = YAHOO.util.Dom.getElementsByClassName('summary', null, this.getEl())[0].firstChild;
|
||||
if (summarysection != null) {
|
||||
this.summary = summarysection.data || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.startDrag = function(x, y) {
|
||||
//operates in point mode
|
||||
YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
|
||||
|
||||
Reference in New Issue
Block a user