I am using extjs4 to build a webapp that resides within drupal.
Many of my ajax calls are to menu items in a module within drupal.
The images my css directs to sometimes reside within my extjs folder, and sometimes in drupal.
A coworker insists that relative paths that use ‘../dir_a/’ are bad design, and are prone to risks.
Is this correct?
Is there another way?
My folder structure:
- drupal
- v2 (extjs home folder)
- css
- extjs
- sites
- mySite
- modules
- webApp
My css files contain calls like these:
.x-action-col-cell img.restart-test-icon {
background-image: url(../extjs/examples/sandbox/images/gears.png);
}
My applications has calls like these:
Ext.Ajax.request({
url: '../webapp/tests/create/',
method: 'Post'
});
Edit: Commenters have asked for clarification.
The coworker’s two main issue with this are:
1. “If the server side code will generate an address like /a/b/c without a trailing / you might have a situation where you get /a/b/c../d“
True? This sounds more like a server side problem.
2. “Have you seen anyone else using it?”
Which in my opinion is a very poor way to decide anything.
But I went ahead and tested some JS intensive sites (gmail, aws), using firebug and found no use of ../ in their JS or CSS.
Can anyone help me back up my claim that it’s perfectly OK?
I can’t think of any problem, if paths are well configured in your files.
It is a poor way, indeed (1). I tried the first website available (stackoverflow.com), see all.css included in this page:
this is a css, but the same applies to js files.
(1) info about fallacies like this one: http://www.fallacyfiles.org/ignorant.html