Comments (4)
Thanks for reporting! Makes sense. We should should add in router.js -> $.addDelegtedListener(function()) a check to the if clause: if a target is given and the target is not "_self", navigate shouldn't be called and default should not be prevented
from layerjs.
Such as...
/*
* Issue #75 :: Anchor tag attribute target="{my value}" seems to be ignored
* as at 9-May-2018
*
* Spec :: We should should add in router.js -> $.addDelegtedListener(function()) a check to the if clause:
* if
* a target is given AND the target is not "_self",
* then
* navigate shouldn't be called AND default should not be prevented
**/
// register link listener
$.addDelegtedListener(this.rootElement, 'click', 'a:not([data-lj-nolink=\'true\']):not([lj-nolink=\'true\'])', function(event) {
//delete that.ignoreUrl;
var _navigationHandler = function(result) {
if (!result) {
setTimeout(function() { // why do we have to get at the end of the queue?
that.ignoreUrl = $.getAbsoluteUrl(href);
window.location.href = href;
}, 1);
}
}
if (this.href !== '' && !this.href.startsWith('javascript:')) { // jshint ignore:line
// get the explicitly given href (that is not extended) to see the intention of the user
var href = this.getAttribute('href');
// check for target attr
var tget = this.getAttribute('target');
// if target is != '_self', honor it as user intention
if( tget && tget !== '_self' ) {
return
}
else {
event.preventDefault(); // prevent default action, i.e. going to link target
// do not stop propagation; other libraries may listen to link clicks
that.navigate(href, $.findParentViewOfType(this, 'layer')).then( _navigationHandler );
}
}
});
Would you like a PR?
from layerjs.
@netaisllc yes please, submit a PR (:
from layerjs.
fixed in 4533a9d
from layerjs.
Related Issues (20)
- size is not adapted during transition
- scrolltransformer scroll event listeners registered multiple times?
- unhandled hash routes -> sets window.location.href
- enlarging frame is not detected (and scroll end is incorrect) HOT 1
- accessive number of lj-active classes added to active frame
- right swipe not working
- no-url option doesnโt seem to work for !none frame
- double loading of layers makes trouble
- scrollTo label does not work if label is not in current frame
- exception on special frame !right if neighbours.r not given
- back button problem in hashrouter HOT 1
- no-url state changes go into history
- Track touch for swipe/pan gestures HOT 1
- Your homepage fails to restore my Safari scrolling to top HOT 6
- Adapt page title when using filerouter HOT 1
- linking to anchors from external does not work
- lj-auto-height is set in stage, and the height of stage does not change automatically. HOT 1
- Layer JS site certificate is expired and other issues HOT 2
- CDN cert date invalid
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from layerjs.