PDA

View Full Version : Anylink Validation Error - rev="lr" obsolete



dmwhipp
08-07-2014, 08:25 PM
1) Script Title: Anylink JS Dropdown Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem:

I love this menu and it's functioning, but I would like to solve the validation error if possible. Here is the installed menu: http://www.altogetherchristmas.com/

When I try to validate at http://html5.validator.nu/, I get the error:
"The rev attribute on the a element is obsolete."

I have the menu updated at another so it validates, but it reveals the items below the anchor, not to the right.

Thanks in advance for any help in getting this to validate.
Deborah

molendijk
08-07-2014, 09:00 PM
http://validator.w3.org/ gives no error.

dmwhipp
08-07-2014, 09:26 PM
I know, but I would like valid HTML5 coding and the rev attribute it obsolete and not a valid attribute for a tags in HTML5.
Thanks,
Deborah

molendijk
08-07-2014, 09:52 PM
You're right, so I'm surprised that http://validator.w3.org/ doesn't complain.

dmwhipp
08-07-2014, 09:54 PM
I don't use it to check HTML5 at all, it misses too much.

dmwhipp
08-10-2014, 06:07 PM
I would really appreciate any help with this if there's anyone that knows how to update these scripts to validate with HtML5.
Thanks,
Deborah

Deadweight
08-10-2014, 10:12 PM
To fix it go to 'anylinkmenu.js'

Replace:


orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",


with


orientation: anchorobj.getAttribute("rel")=="lr"? "lr" : "ud",

dmwhipp
08-11-2014, 12:47 AM
It works, but now I'm getting a different error:
"Error: Bad value lr for attribute rel on element a: The string lr is not a registered keyword."

Here is the test page: http://www.altogetherchristmas.com/menutest.html

Deadweight
08-11-2014, 01:55 AM
Change it to something like this and let me know:
html link code:


<a class="menuanchorclass" href="/decorating.html" id="menu3" data-rel="lr">


Change the JS file to:


orientation: anchorobj.getAttribute("data-rel")=="lr"? "lr" : "ud",

vwphillips
08-11-2014, 10:00 AM
changes in red

html



<p><a href="http://www.dynamicdrive.com" class="menuanchorclass someotherclass orientation:lr" rel="anylinkmenu2[click]">Right dropping menu</a> (click to reveal)</p>


code

new function




cls:function(o,nme){
for (var s=o.className.split(' '),i,z0=0;z0<s.length;z0++){
i=s[z0].indexOf(':');
if (s[z0].slice(0,i)==nme){
return s[z0].slice(i+1);
}
}
return '?';
},



modified line




setupmenu:function(targetclass, anchorobj, pos){
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
var relattr=anchorobj.getAttribute("rel")
dropmenuid=relattr.replace(/\[(\w+)\]/, '')
var dropmenuvar=window[dropmenuid]
var dropmenu=this.addDiv(null, dropmenuvar.divclass, dropmenuvar.inlinestyle) //create and add main sub menu DIV
dropmenu.innerHTML=this.getmenuHTML(dropmenuvar)
var menu=this.menusmap[targetclass+pos]={
id: targetclass+pos,
anchorobj: anchorobj,
dropmenu: dropmenu,
revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click") || anylinkmenu.ismobile ? "click" : "mouseover",
orientation: this.cls(anchorobj,'orientation')=="lr"? "lr" : "ud",
shadow: this.addDiv(null, "anylinkshadow", null) //create and add corresponding shadow
}
menu.anchorobj._internalID=targetclass+pos
menu.anchorobj._isanchor=true
menu.dropmenu._internalID=targetclass+pos
menu.shadow._internalID=targetclass+pos
menu.dropmenu.setcss=this.setcss
menu.shadow.setcss=this.setcss
menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
this.setopacity(menu.shadow, this.effects.shadow.opacity)
this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOVER event for anchor, dropmenu, shadow
var menu=anylinkmenu.menusmap[this._internalID]
if (this._isanchor && menu.revealtype=="mouseover" && !anylinkmenu.isContained(this, e)){ //event for anchor
anylinkmenu.showmenu(menu.id)
anylinkmenu.addState(this, "add")
}
else if (typeof this._isanchor=="undefined"){ //event for drop down menu and shadow
clearTimeout(menu.hidetimer)
}
}, "mouseover")
this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOUT event for anchor, dropmenu, shadow
if (!anylinkmenu.isContained(this, e)){
var menu=anylinkmenu.menusmap[this._internalID]
menu.hidetimer=setTimeout(function(){
anylinkmenu.addState(menu.anchorobj, "remove")
anylinkmenu.hidemenu(menu.id)
}, anylinkmenu.effects.delayhide)
}
}, "mouseout")
this.addEvent([menu.anchorobj, menu.dropmenu], function(e){ //CLICK event for anchor, dropmenu
var menu=anylinkmenu.menusmap[this._internalID]
if ( this._isanchor && menu.revealtype=="click"){
if (menu.dropmenu.style.visibility=="visible")
anylinkmenu.hidemenu(menu.id)
else{
anylinkmenu.addState(this, "add")
anylinkmenu.showmenu(menu.id)
}
if (e.preventDefault)
e.preventDefault()
return false
}
else
menu.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(menu.id)}, anylinkmenu.effects.delayhide)
}, "click")
},

dmwhipp
09-01-2014, 07:43 PM
Sorry for the delay - I've been swamped with work and family stuff. The coding from Deadweight worked.
Deborah